summaryrefslogtreecommitdiffstats
path: root/src/style.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-05-20 17:40:03 -0400
committerDan Davison <dandavison7@gmail.com>2020-05-22 22:23:28 -0400
commit291d2fb7fa8cfc2a0886af895972326d00fb4dbe (patch)
treea24d3fd37156c6df862beb851a750f053945514e /src/style.rs
parentf08effc46de52655c8431498c6bc214c0eda30e5 (diff)
Use ansi_term style data structures instead of syntect
Diffstat (limited to 'src/style.rs')
-rw-r--r--src/style.rs171
1 files changed, 33 insertions, 138 deletions
diff --git a/src/style.rs b/src/style.rs
index 339e3f02..0c6729cd 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -1,4 +1,4 @@
-use syntect::highlighting::{Color, FontStyle, Style, StyleModifier};
+use ansi_term::Color;
pub const LIGHT_THEMES: [&str; 5] = [
"GitHub",
@@ -55,143 +55,38 @@ pub fn get_plus_emph_color_default(is_light_mode: bool, is_true_color: bool) ->
}
}
-const LIGHT_THEME_MINUS_COLOR: Color = Color {
- r: 0xff,
- g: 0xe0,
- b: 0xe0,
- a: 0xff,
-};
-
-const LIGHT_THEME_MINUS_COLOR_256: Color = Color {
- r: 224,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color {
- r: 0xff,
- g: 0xc0,
- b: 0xc0,
- a: 0xff,
-};
-
-const LIGHT_THEME_MINUS_EMPH_COLOR_256: Color = Color {
- r: 217,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const LIGHT_THEME_PLUS_COLOR: Color = Color {
- r: 0xd0,
- g: 0xff,
- b: 0xd0,
- a: 0xff,
-};
-
-const LIGHT_THEME_PLUS_COLOR_256: Color = Color {
- r: 194,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const LIGHT_THEME_PLUS_EMPH_COLOR: Color = Color {
- r: 0xa0,
- g: 0xef,
- b: 0xa0,
- a: 0xff,
-};
-
-const LIGHT_THEME_PLUS_EMPH_COLOR_256: Color = Color {
- r: 157,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const DARK_THEME_MINUS_COLOR: Color = Color {
- r: 0x3f,
- g: 0x00,
- b: 0x01,
- a: 0xff,
-};
-
-const DARK_THEME_MINUS_COLOR_256: Color = Color {
- r: 52,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const DARK_THEME_MINUS_EMPH_COLOR: Color = Color {
- r: 0x90,
- g: 0x10,
- b: 0x11,
- a: 0xff,
-};
-
-const DARK_THEME_MINUS_EMPH_COLOR_256: Color = Color {
- r: 124,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const DARK_THEME_PLUS_COLOR: Color = Color {
- r: 0x00,
- g: 0x28,
- b: 0x00,
- a: 0xff,
-};
-
-const DARK_THEME_PLUS_COLOR_256: Color = Color {
- r: 22,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-const DARK_THEME_PLUS_EMPH_COLOR: Color = Color {
- r: 0x00,
- g: 0x60,
- b: 0x00,
- a: 0xff,
-};
-
-const DARK_THEME_PLUS_EMPH_COLOR_256: Color = Color {
- r: 28,
- g: 0x00,
- b: 0x00,
- a: 0x00,
-};
-
-/// A special color to specify that no color escape codes should be emitted.
-pub const NO_COLOR: Color = Color::BLACK;
+const LIGHT_THEME_MINUS_COLOR: Color = Color::RGB(0xff, 0xe0, 0xe0);
+
+const LIGHT_THEME_MINUS_COLOR_256: Color = Color::Fixed(224);
+
+const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color::RGB(0xff, 0xc0, 0xc0);
+
+const LIGHT_THEME_MINUS_EMPH_COLOR_256: Color = Color::Fixed(217);
+
+const LIGHT_THEME_PLUS_COLOR: Color = Color::RGB(0xd0, 0xff, 0xd0);
+
+const LIGHT_THEME_PLUS_COLOR_256: Color = Color::Fixed(194);
+
+const LIGHT_THEME_PLUS_EMPH_COLOR: Color = Color::RGB(0xa0, 0xef, 0xa0);
+
+const LIGHT_THEME_PLUS_EMPH_COLOR_256: Color = Color::Fixed(157);
+
+const DARK_THEME_MINUS_COLOR: Color = Color::RGB(0x3f, 0x00, 0x01);
+
+const DARK_THEME_MINUS_COLOR_256: Color = Color::Fixed(52);
+
+const DARK_THEME_MINUS_EMPH_COLOR: Color = Color::RGB(0x90, 0x10, 0x11);
+
+const DARK_THEME_MINUS_EMPH_COLOR_256: Color = Color::Fixed(124);
+
+const DARK_THEME_PLUS_COLOR: Color = Color::RGB(0x00, 0x28, 0x00);
+
+const DARK_THEME_PLUS_COLOR_256: Color = Color::Fixed(22);
+
+const DARK_THEME_PLUS_EMPH_COLOR: Color = Color::RGB(0x00, 0x60, 0x00);
+
+const DARK_THEME_PLUS_EMPH_COLOR_256: Color = Color::Fixed(28);
/// A special color value to signify that the foreground color of a style should be derived from
/// syntax highlighting.
-// alpha is 0, which is how the 256-palette colors are encoded (see bat::terminal::to_ansi_color).
-// So if painted, this would be black. However, the presence of a non-zero bit in the blue channel
-// distinguishes this from any 256-palette color.
-pub const SYNTAX_HIGHLIGHTING_COLOR: Color = Color {
- r: 0x00,
- g: 0x00,
- b: 0x01,
- a: 0x00,
-};
-
-pub fn get_no_style() -> Style {
- Style {
- foreground: NO_COLOR,
- background: NO_COLOR,
- font_style: FontStyle::empty(),
- }
-}
-
-pub const NO_BACKGROUND_COLOR_STYLE_MODIFIER: StyleModifier = StyleModifier {
- foreground: None,
- background: Some(NO_COLOR),
- font_style: None,
-};
+pub const SYNTAX_HIGHLIGHTING_COLOR: Color = Color::White; // TODO