diff options
author | Dan Davison <dandavison7@gmail.com> | 2019-07-13 14:22:54 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2019-07-13 14:41:28 -0400 |
commit | 44bb12703ff60735a5547ff1ab200da868b36806 (patch) | |
tree | bcf933aaa2594591fda62c88abda6f6558a6faf9 /src/style.rs | |
parent | 8857ced8f03506126607bfb74534c5ff1fbacd23 (diff) |
Refactor: create config and style modules
Diffstat (limited to 'src/style.rs')
-rw-r--r-- | src/style.rs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/style.rs b/src/style.rs new file mode 100644 index 00000000..13faab1b --- /dev/null +++ b/src/style.rs @@ -0,0 +1,80 @@ +use syntect::highlighting::{Color, StyleModifier}; + +pub const LIGHT_THEMES: [&str; 4] = [ + "GitHub", + "Monokai Extended Light", + "OneHalfLight", + "ansi-light", +]; + +pub const DEFAULT_LIGHT_THEME: &str = "GitHub"; +pub const DEFAULT_DARK_THEME: &str = "Monokai Extended"; + +pub fn is_light_theme(theme: &str) -> bool { + LIGHT_THEMES.contains(&theme) +} + +pub const LIGHT_THEME_MINUS_COLOR: Color = Color { + r: 0xff, + g: 0xd0, + b: 0xd0, + a: 0xff, +}; + +pub const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color { + r: 0xef, + g: 0xa0, + b: 0xa0, + a: 0xff, +}; + +pub const LIGHT_THEME_PLUS_COLOR: Color = Color { + r: 0xd0, + g: 0xff, + b: 0xd0, + a: 0xff, +}; + +pub const LIGHT_THEME_PLUS_EMPH_COLOR: Color = Color { + r: 0xa0, + g: 0xef, + b: 0xa0, + a: 0xff, +}; + +pub const DARK_THEME_MINUS_COLOR: Color = Color { + r: 0x3F, + g: 0x00, + b: 0x01, + a: 0xff, +}; + +pub const DARK_THEME_MINUS_EMPH_COLOR: Color = Color { + r: 0x90, + g: 0x10, + b: 0x11, + a: 0xff, +}; + +pub const DARK_THEME_PLUS_COLOR: Color = Color { + r: 0x01, + g: 0x3B, + b: 0x01, + a: 0xff, +}; + +pub const DARK_THEME_PLUS_EMPH_COLOR: Color = Color { + r: 0x11, + g: 0x80, + b: 0x11, + a: 0xff, +}; + +/// A special color to specify that no color escape codes should be emitted. +pub const NO_COLOR: Color = Color::BLACK; + +pub const NO_BACKGROUND_COLOR_STYLE_MODIFIER: StyleModifier = StyleModifier { + foreground: None, + background: Some(NO_COLOR), + font_style: None, +}; |