From 649d33ca68889669d62817765bf8d6a3441b6949 Mon Sep 17 00:00:00 2001 From: Colin Reeder Date: Sat, 8 Aug 2020 16:32:21 -0600 Subject: Use SVG icons instead of emoji --- icons/Cargo.toml | 10 ++++++++ icons/res/notifications-some.svg | 7 ++++++ icons/res/notifications.svg | 5 ++++ icons/res/person.svg | 4 ++++ icons/src/lib.rs | 49 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 icons/Cargo.toml create mode 100644 icons/res/notifications-some.svg create mode 100644 icons/res/notifications.svg create mode 100644 icons/res/person.svg create mode 100644 icons/src/lib.rs (limited to 'icons') diff --git a/icons/Cargo.toml b/icons/Cargo.toml new file mode 100644 index 0000000..48bb80b --- /dev/null +++ b/icons/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "hitide_icons" +version = "0.1.0" +authors = ["Colin Reeder "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +phf = { version = "0.8.0", features = ["macros"] } diff --git a/icons/res/notifications-some.svg b/icons/res/notifications-some.svg new file mode 100644 index 0000000..5eef1fa --- /dev/null +++ b/icons/res/notifications-some.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/icons/res/notifications.svg b/icons/res/notifications.svg new file mode 100644 index 0000000..45a55d1 --- /dev/null +++ b/icons/res/notifications.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/icons/res/person.svg b/icons/res/person.svg new file mode 100644 index 0000000..78d7385 --- /dev/null +++ b/icons/res/person.svg @@ -0,0 +1,4 @@ + + + + diff --git a/icons/src/lib.rs b/icons/src/lib.rs new file mode 100644 index 0000000..355e674 --- /dev/null +++ b/icons/src/lib.rs @@ -0,0 +1,49 @@ +pub struct Icon { + pub path: &'static str, + pub content: &'static str, +} + +macro_rules! icons_consts { + ($i:ident => $p:expr) => { + pub const $i: Icon = Icon { + path: $p, + content: include_str!(concat!("../res/", $p)), + }; + }; + ($i1:ident => $p1:expr, $($i2:ident => $p2:expr),+) => { + icons_consts! { $i1 => $p1 } + icons_consts! { $($i2 => $p2),+ } + } +} + +macro_rules! icons_map { + ($($i:ident => $p:expr),+) => { + pub const ICONS_MAP: phf::Map<&'static str, &'static Icon> = phf::phf_map! { + $($p => &icons::$i),+ + }; + } +} + +macro_rules! icons { + ($($i:ident => $p:expr),+) => { + pub mod icons { + use super::Icon; + + icons_consts! { + $($i => $p),+ + } + } + + icons_map! { + $($i => $p),+ + } + } +} + +icons! { + NOTIFICATIONS => "notifications.svg", + NOTIFICATIONS_SOME => "notifications-some.svg", + PERSON => "person.svg" +} + +pub use icons::*; -- cgit v1.2.3