summaryrefslogblamecommitdiffstats
path: root/src/icon.rs
blob: b0ef60e1d63c7ea703ca7e9cf818445456fab397 (plain) (tree)














































































































                                                                                   
#[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,
        }
    }
}