From 7539914ba81183bbc1506952d7ed260e0c4ec9ca Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Thu, 21 Nov 2024 12:35:14 -0500 Subject: Thu Nov 21 12:35:14 PM EST 2024 --- .gitignore | 1 + Cargo.toml | 7 +++++++ src/lib.rs | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..066c26d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "filetype_fonticons" +version = "0.1.0" +edition = "2021" + +[dependencies] +lazy_static = "1.5.0" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..ff031ee --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,67 @@ +use lazy_static::lazy_static; +use std::collections::HashMap; + +#[derive(Debug, Clone, Copy)] +pub struct FileIcon { + pub icon: char, + pub color: u32, +} + +impl Default for FileIcon { + fn default() -> Self { + Self { + icon: '', + color: 0xFFFFFF, + } + } +} + +lazy_static! { + pub static ref ICONS_BY_EXTENSION: HashMap<&'static str, FileIcon> = HashMap::from([ + ( + "glb", + FileIcon { + icon: '󰆧', + color: 0x87C63E, + } + ), + ( + "gltf", + FileIcon { + icon: '󰆧', + color: 0x87C63E, + } + ), + ( + "png", + FileIcon { + icon: '', + color: 0xA074C4, + } + ), + ( + "rs", + FileIcon { + icon: '', + color: 0xDEA584, + } + ), + ( "mid", + FileIcon { + icon: '󰎇', + color: 0x800080, + } + ), + ( "wav", + FileIcon { + icon: '󱑽', + color: 0xF74231, + } + ) + ]); +} + +pub const FOLDER_ICON: FileIcon = FileIcon { + icon: '', + color: 0xFFFFFF, +}; -- cgit v1.2.3