summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:35:14 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:35:14 -0500
commit7539914ba81183bbc1506952d7ed260e0c4ec9ca (patch)
treee2ea98cde4126721608c61a115f94e6a3dc50f99
Thu Nov 21 12:35:14 PM EST 2024
-rw-r--r--.gitignore1
-rw-r--r--Cargo.toml7
-rw-r--r--src/lib.rs67
3 files changed, 75 insertions, 0 deletions
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,
+};