summaryrefslogtreecommitdiffstats
path: root/src/style.rs
blob: 89582348c165263706700eac47782e757e1134cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use syntect::highlighting::{Color, FontStyle, Style, 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: 0xe0,
    b: 0xe0,
    a: 0xff,
};

pub const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color {
    r: 0xff,
    g: 0xb0,
    b: 0xb0,
    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 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,
};