aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/theme.rs
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-09-25 20:14:59 +0000
committerDmitry Sharshakov2021-09-25 20:14:59 +0000
commitbf53aff27d2d90b41bab01f4d628f0bd9fbcd589 (patch)
tree568d745540acd05ae7526e8a3eed7ee8e31e3cea /helix-view/src/theme.rs
parent413e477dc2d4792596f99979140d2879ec3d4f4f (diff)
parentdf55eaae69d0388de26448e82f9ded483fca2f44 (diff)
Merge branch 'master' into debug
Diffstat (limited to 'helix-view/src/theme.rs')
-rw-r--r--helix-view/src/theme.rs29
1 files changed, 27 insertions, 2 deletions
diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs
index 74b817d0..9c33685b 100644
--- a/helix-view/src/theme.rs
+++ b/helix-view/src/theme.rs
@@ -5,6 +5,7 @@ use std::{
};
use anyhow::Context;
+use helix_core::hashmap;
use log::warn;
use once_cell::sync::Lazy;
use serde::{Deserialize, Deserializer};
@@ -142,13 +143,37 @@ struct ThemePalette {
impl Default for ThemePalette {
fn default() -> Self {
- Self::new(HashMap::new())
+ Self {
+ palette: hashmap! {
+ "black".to_string() => Color::Black,
+ "red".to_string() => Color::Red,
+ "green".to_string() => Color::Green,
+ "yellow".to_string() => Color::Yellow,
+ "blue".to_string() => Color::Blue,
+ "magenta".to_string() => Color::Magenta,
+ "cyan".to_string() => Color::Cyan,
+ "gray".to_string() => Color::Gray,
+ "light-red".to_string() => Color::LightRed,
+ "light-green".to_string() => Color::LightGreen,
+ "light-yellow".to_string() => Color::LightYellow,
+ "light-blue".to_string() => Color::LightBlue,
+ "light-magenta".to_string() => Color::LightMagenta,
+ "light-cyan".to_string() => Color::LightCyan,
+ "light-gray".to_string() => Color::LightGray,
+ "white".to_string() => Color::White,
+ },
+ }
}
}
impl ThemePalette {
pub fn new(palette: HashMap<String, Color>) -> Self {
- Self { palette }
+ let ThemePalette {
+ palette: mut default,
+ } = ThemePalette::default();
+
+ default.extend(palette);
+ Self { palette: default }
}
pub fn hex_string_to_rgb(s: &str) -> Result<Color, String> {