|
|
@@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
pub struct Colors {
|
|
|
- pub map: HashMap<String, String>,
|
|
|
+ pub inner: HashMap<String, String>,
|
|
|
}
|
|
|
|
|
|
impl Default for Colors {
|
|
|
@@ -16,10 +16,16 @@ impl Default for Colors {
|
|
|
("blue", "#669bbc"),
|
|
|
("dark_blue", "#003049"),
|
|
|
];
|
|
|
- let map: HashMap<_, _> = def
|
|
|
+ let inner: HashMap<_, _> = def
|
|
|
.into_iter()
|
|
|
.map(|(k, v)| (k.to_string(), v.to_string()))
|
|
|
.collect();
|
|
|
- Self { map }
|
|
|
+ Self { inner }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+impl Colors {
|
|
|
+ pub fn get(&self, key: &str) -> String {
|
|
|
+ self.inner.get(key).cloned().unwrap_or_else(|| "#669bbc".to_string())
|
|
|
}
|
|
|
}
|