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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
pub enum ColorScheme {
#[serde(alias = "archlinux")]
ArchLinux,
#[serde(alias = "zenburn")]
Zenburn,
#[serde(alias = "monokai")]
Monokai,
}
impl ColorScheme {
/// Returns the URL-compatible name of a color scheme
pub fn to_string(&self) -> String {
match &self {
ColorScheme::ArchLinux => "archlinux",
ColorScheme::Zenburn => "zenburn",
ColorScheme::Monokai => "monokai",
}
.to_string()
}
/// Returns wether a color scheme is dark
pub fn is_dark(&self) -> bool {
match &self {
ColorScheme::ArchLinux => true,
ColorScheme::Zenburn => true,
ColorScheme::Monokai => true,
}
}
/// Returns the name of a color scheme
pub fn get_name(&self) -> String {
match &self {
ColorScheme::ArchLinux => "Archlinux",
ColorScheme::Zenburn => "Zenburn",
ColorScheme::Monokai => "Monokai",
}
.to_string()
}
/// Lists available color schemes
pub fn get_color_schemes() -> Vec<Self> {
vec![
ColorScheme::ArchLinux,
ColorScheme::Zenburn,
ColorScheme::Monokai,
]
}
/// Retrieves the color palette associated to a color scheme
pub fn get_theme(self) -> Theme {
match self {
ColorScheme::ArchLinux => Theme {
background: "#383c4a".to_string(),
text_color: "#fefefe".to_string(),
directory_link_color: "#03a9f4".to_string(),
file_link_color: "#ea95ff".to_string(),
symlink_link_color: "#ff9800".to_string(),
table_background: "#353946".to_string(),
table_text_color: "#eeeeee".to_string(),
table_header_background: "#5294e2".to_string(),
table_header_text_color: "#eeeeee".to_string(),
table_header_active_color: "#ffffff".to_string(),
active_row_color: "#5194e259".to_string(),
odd_row_background: "#404552".to_string(),
even_row_background: "#4b5162".to_string(),
root_link_color: "#abb2bb".to_string(),
download_button_background: "#ea95ff".to_string(),
download_button_background_hover: "#eea7ff".to_string(),
download_button_link_color: "#ffffff".to_string(),
download_button_link_color_hover: "#ffffff".to_string(),
back_button_background: "#ea95ff".to_string(),
back_button_background_hover: "#ea95ff".to_string(),
back_button_link_color: "#ffffff".to_string(),
back_button_link_color_hover: "#ffffff".to_string(),
date_text_color: "#9ebbdc".to_string(),
at_color: "#9ebbdc".to_string(),
switch_theme_background: "#4b5162".to_string(),
switch_theme_link_color: "#fefefe".to_string(),
switch_theme_active: "#ea95ff".to_string(),
switch_theme_border: "#6a728a".to_string(),
change_theme_link_color: "#fefefe".to_string(),
change_theme_link_color_hover: "#fefefe".to_string(),
field_color: "#859cb9".to_string(),
},
ColorScheme::Zenburn => Theme {
background: "#3f3f3f".to_string(),
text_color: "#efefef".to_string(),
directory_link_color: "#f0dfaf".to_string(),
file_link_color: "#87D6D5".to_string(),
symlink_link_color: "#FFCCEE".to_string(),
table_background: "#4a4949".to_string(),
table_text_color: "#efefef".to_string(),
table_header_background: "#7f9f7f".to_string(),
table_header_text_color: "#efefef".to_string(),
table_header_active_color: "#efef8f".to_string(),
active_row_color: "#7e9f7f9c".to_string(),
odd_row_background: "#777777".to_string(),
even_row_background: "#5a5a5a".to_string(),
root_link_color: "#dca3a3".to_string(),
download_button_background: "#cc9393".to_string(),
download_button_background_hover: "#dca3a3".to_string(),
download_button_link_color: "#efefef".to_string(),
download_button_link_color_hover: "#efefef".to_string(),
back_button_background: "#cc9393".to_string(),
back_button_background_hover: "#cc9393".to_string(),
back_button_link_color: "#efefef".to_string(),
back_button_link_color_hover: "#efefef".to_string(),
date_text_color: "#cfbfaf".to_string(),
at_color: "#cfbfaf".to_string(),
switch_theme_background: "#4a4949".to_string(),
switch_theme_link_color: "#efefef".to_string(),
switch_theme_active: "#efef8f".to_string(),
switch_theme_border: "#5a5a5a".to_string(),
change_theme_link_color: "#efefef".to_string(),
change_theme_link_color_hover: "#efefef".to_string(),
field_color: "#9fc3a1".to_string(),
},
ColorScheme::Monokai => Theme {
background: "#272822".to_string(),
text_color: "#F8F8F2".to_string(),
directory_link_color: "#F92672".to_string(),
file_link_color: "#A6E22E".to_string(),
symlink_link_color: "#FD971F".to_string(),
table_background: "#3B3A32".to_string(),
table_text_color: "#F8F8F0".to_string(),
table_header_background: "#75715E".to_string(),
table_header_text_color: "#F8F8F2".to_string(),
table_header_active_color: "#E6DB74".to_string(),
active_row_color: "#ae81fe3d".to_string(),
odd_row_background: "#3E3D32".to_string(),
even_row_background: "#49483E".to_string(),
root_link_color: "#66D9EF".to_string(),
download_button_background: "#AE81FF".to_string(),
download_button_background_hover: "#c6a6ff".to_string(),
download_button_link_color: "#F8F8F0".to_string(),
download_button_link_color_hover: "#F8F8F0".to_string(),
back_button_background: "#AE81FF".to_string(),
back_button_background_hover: "#AE81FF".to_string(),
back_button_link_color: "#F8F8F0".to_string(),
back_button_link_color_hover: "#F8F8F0".to_string(),
date_text_color: "#66D9EF".to_string(),
at_color: "#66D9EF".to_string(),
switch_theme_background: "#3B3A32".to_string(),
switch_theme_link_color: "#F8F8F2".to_string(),
switch_theme_active: "#A6E22E".to_string(),
switch_theme_border: "#49483E".to_string(),
change_theme_link_color: "#F8F8F2".to_string(),
change_theme_link_color_hover: "#F8F8F2".to_string(),
field_color: "#ccc7a7".to_string(),
},
}
}
}
/// Describes a theme
pub struct Theme {
pub background: String,
pub text_color: String,
pub directory_link_color: String,
pub file_link_color: String,
pub symlink_link_color: String,
pub table_background: String,
pub table_text_color: String,
pub table_header_background: String,
pub table_header_text_color: String,
pub table_header_active_color: String,
pub active_row_color: String,
pub odd_row_background: String,
pub even_row_background: String,
pub root_link_color: String,
pub download_button_background: String,
pub download_button_background_hover: String,
pub download_button_link_color: String,
pub download_button_link_color_hover: String,
pub back_button_background: String,
pub back_button_background_hover: String,
pub back_button_link_color: String,
pub back_button_link_color_hover: String,
pub date_text_color: String,
pub at_color: String,
pub switch_theme_background: String,
pub switch_theme_link_color: String,
pub switch_theme_active: String,
pub switch_theme_border: String,
pub change_theme_link_color: String,
pub change_theme_link_color_hover: String,
pub field_color: String,
}
|