summaryrefslogtreecommitdiffstats
path: root/src/icon.rs
blob: b0ef60e1d63c7ea703ca7e9cf818445456fab397 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#[derive(Copy, Clone)]
pub enum Icon {
    AddContact24,
    Attachment24,
    Away16,
    Away16Color,
    Bubble16,
    Bubble16Color,
    Bubble24,
    Close24,
    Contact24,
    Delivered16,
    Dnd16,
    Dnd16Color,
    Error16Color,
    Forward24,
    Heart24,
    NewBubble24,
    Reply24,
    Sending16,
    Sent16,
    Chat16Color,
    Xa16Color,
    Available16Color,
}

pub const ICONS_SRC: &str = "/assets/icons/";

impl Icon {
    pub fn src(&self) -> String {
        match self {
            Icon::AddContact24 => format!("{}addcontact24.svg", ICONS_SRC),
            Icon::Attachment24 => format!("{}attachment24.svg", ICONS_SRC),
            Icon::Away16 => format!("{}away16.svg", ICONS_SRC),
            Icon::Away16Color => format!("{}away16color.svg", ICONS_SRC),
            Icon::Bubble16 => format!("{}bubble16.svg", ICONS_SRC),
            Icon::Bubble16Color => format!("{}bubble16color.svg", ICONS_SRC),
            Icon::Bubble24 => format!("{}bubble24.svg", ICONS_SRC),
            Icon::Close24 => format!("{}close24.svg", ICONS_SRC),
            Icon::Contact24 => format!("{}contact24.svg", ICONS_SRC),
            Icon::Delivered16 => format!("{}delivered16.svg", ICONS_SRC),
            Icon::Dnd16 => format!("{}dnd16.svg", ICONS_SRC),
            Icon::Dnd16Color => format!("{}dnd16color.svg", ICONS_SRC),
            Icon::Error16Color => format!("{}error16color.svg", ICONS_SRC),
            Icon::Forward24 => format!("{}forward24.svg", ICONS_SRC),
            Icon::Heart24 => format!("{}heart24.svg", ICONS_SRC),
            Icon::NewBubble24 => format!("{}newbubble24.svg", ICONS_SRC),
            Icon::Reply24 => format!("{}reply24.svg", ICONS_SRC),
            Icon::Sending16 => format!("{}sending16.svg", ICONS_SRC),
            Icon::Sent16 => format!("{}sent16.svg", ICONS_SRC),
            Icon::Chat16Color => format!("{}chat16color.svg", ICONS_SRC),
            Icon::Xa16Color => format!("{}xa16color.svg", ICONS_SRC),
            Icon::Available16Color => format!("{}available16color.svg", ICONS_SRC),
        }
    }

    pub fn size(&self) -> isize {
        match self {
            Icon::AddContact24 => 24,
            Icon::Attachment24 => 24,
            Icon::Away16 => 16,
            Icon::Away16Color => 16,
            Icon::Bubble16 => 16,
            Icon::Bubble16Color => 16,
            Icon::Bubble24 => 24,
            Icon::Close24 => 24,
            Icon::Contact24 => 24,
            Icon::Delivered16 => 16,
            Icon::Dnd16 => 16,
            Icon::Dnd16Color => 16,
            Icon::Error16Color => 16,
            Icon::Forward24 => 24,
            Icon::Heart24 => 24,
            Icon::NewBubble24 => 24,
            Icon::Reply24 => 24,
            Icon::Sending16 => 16,
            Icon::Sent16 => 16,
            Icon::Chat16Color => 16,
            Icon::Xa16Color => 16,
            Icon::Available16Color => 16,
        }
    }

    pub fn light(&self) -> bool {
        match self {
            Icon::AddContact24 => true,
            Icon::Attachment24 => true,
            Icon::Away16 => true,
            Icon::Away16Color => false,
            Icon::Bubble16 => true,
            Icon::Bubble16Color => false,
            Icon::Bubble24 => true,
            Icon::Close24 => true,
            Icon::Contact24 => true,
            Icon::Delivered16 => true,
            Icon::Dnd16 => true,
            Icon::Dnd16Color => false,
            Icon::Error16Color => false,
            Icon::Forward24 => true,
            Icon::Heart24 => true,
            Icon::NewBubble24 => true,
            Icon::Reply24 => true,
            Icon::Sending16 => true,
            Icon::Sent16 => true,
            Icon::Chat16Color => false,
            Icon::Xa16Color => false,
            Icon::Available16Color => false,
        }
    }
}