diff options
author | Dmitry Sharshakov | 2021-09-25 20:14:59 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-09-25 20:14:59 +0000 |
commit | bf53aff27d2d90b41bab01f4d628f0bd9fbcd589 (patch) | |
tree | 568d745540acd05ae7526e8a3eed7ee8e31e3cea /helix-view/src/theme.rs | |
parent | 413e477dc2d4792596f99979140d2879ec3d4f4f (diff) | |
parent | df55eaae69d0388de26448e82f9ded483fca2f44 (diff) |
Merge branch 'master' into debug
Diffstat (limited to 'helix-view/src/theme.rs')
-rw-r--r-- | helix-view/src/theme.rs | 29 |
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> { |