From 44bb12703ff60735a5547ff1ab200da868b36806 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 13 Jul 2019 14:22:54 -0400 Subject: Refactor: create config and style modules --- src/style.rs | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/style.rs (limited to 'src/style.rs') 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, +}; -- cgit v1.2.3