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
use crossterm::style::Color;
use crossterm::style::Color::Rgb;
#[derive(PartialEq, Clone, Copy)]
pub enum Type {
None,
Number,
Match,
String,
Character,
Comment,
MultilineComment,
PrimaryKeywords,
SecondaryKeywords,
}
impl Type {
pub fn to_color(self) -> Color {
use Type::*;
match self {
Number => Rgb {
r: 220,
g: 163,
b: 163,
},
Match => Rgb {
r: 38,
g: 139,
b: 210,
},
String => Rgb {
r: 211,
g: 54,
b: 130,
},
Character => Rgb {
r: 108,
g: 113,
b: 196,
},
Comment | MultilineComment => Rgb {
r: 133,
g: 153,
b: 0,
},
PrimaryKeywords => Rgb {
r: 181,
g: 137,
b: 0,
},
SecondaryKeywords => Rgb {
r: 42,
g: 161,
b: 152,
},
_ => Rgb {
r: 255,
g: 255,
b: 255,
},
}
}
}