aboutsummaryrefslogtreecommitdiffstats
path: root/src/themes.rs
blob: 65e9ab2556a5ed815a0766ec5f6e44191d50914a (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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
use serde::Deserialize;
use structopt::clap::arg_enum;
use strum_macros::EnumIter;

arg_enum! {
    #[derive(PartialEq, Deserialize, Clone, EnumIter, Copy)]
    #[serde(rename_all = "lowercase")]
    pub enum ColorScheme {
        Archlinux,
        Zenburn,
        Monokai,
        Squirrel,
    }
}

impl ColorScheme {
    /// Returns the URL-compatible name of a color scheme
    /// This must correspond to the name of the variant, in lowercase
    /// See https://github.com/svenstaro/miniserve/pull/55 for explanations
    pub fn to_slug(self) -> String {
        match self {
            ColorScheme::Archlinux => "archlinux",
            ColorScheme::Zenburn => "zenburn",
            ColorScheme::Monokai => "monokai",
            ColorScheme::Squirrel => "squirrel",
        }
        .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,
            ColorScheme::Squirrel => false,
        }
    }

    /// 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(),
                upload_text_color: "#fefefe".to_string(),
                upload_form_border_color: "#353946".to_string(),
                upload_form_background: "#4b5162".to_string(),
                upload_button_background: "#ea95ff".to_string(),
                upload_button_text_color: "#ffffff".to_string(),
                drag_background: "#3333338f".to_string(),
                drag_border_color: "#fefefe".to_string(),
                drag_text_color: "#fefefe".to_string(),
                size_background_color: "#5294e2".to_string(),
                size_text_color: "#fefefe".to_string(),
                error_color: "#e44b4b".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(),
                upload_text_color: "#efefef".to_string(),
                upload_form_border_color: "#4a4949".to_string(),
                upload_form_background: "#777777".to_string(),
                upload_button_background: "#cc9393".to_string(),
                upload_button_text_color: "#efefef".to_string(),
                drag_background: "#3333338f".to_string(),
                drag_border_color: "#efefef".to_string(),
                drag_text_color: "#efefef".to_string(),
                size_background_color: "#7f9f7f".to_string(),
                size_text_color: "#efefef".to_string(),
                error_color: "#d06565".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(),
                upload_text_color: "#F8F8F2".to_string(),
                upload_form_border_color: "#3B3A32".to_string(),
                upload_form_background: "#49483E".to_string(),
                upload_button_background: "#AE81FF".to_string(),
                upload_button_text_color: "#F8F8F0".to_string(),
                drag_background: "#3333338f".to_string(),
                drag_border_color: "#F8F8F2".to_string(),
                drag_text_color: "#F8F8F2".to_string(),
                size_background_color: "#75715E".to_string(),
                size_text_color: "#F8F8F2".to_string(),
                error_color: "#d02929".to_string(),
            },
            ColorScheme::Squirrel => Theme {
                background: "#FFFFFF".to_string(),
                text_color: "#323232".to_string(),
                directory_link_color: "#d02474".to_string(),
                file_link_color: "#0086B3".to_string(),
                symlink_link_color: "#ED6A43".to_string(),
                table_background: "#ffffff".to_string(),
                table_text_color: "#323232".to_string(),
                table_header_background: "#323232".to_string(),
                table_header_text_color: "#F5F5F5".to_string(),
                table_header_active_color: "#FFFFFF".to_string(),
                active_row_color: "#f6f8fa".to_string(),
                odd_row_background: "#fbfbfb".to_string(),
                even_row_background: "#f2f2f2".to_string(),
                root_link_color: "#323232".to_string(),
                download_button_background: "#d02474".to_string(),
                download_button_background_hover: "#f52d8a".to_string(),
                download_button_link_color: "#FFFFFF".to_string(),
                download_button_link_color_hover: "#FFFFFF".to_string(),
                back_button_background: "#d02474".to_string(),
                back_button_background_hover: "#d02474".to_string(),
                back_button_link_color: "#FFFFFF".to_string(),
                back_button_link_color_hover: "#FFFFFF".to_string(),
                date_text_color: "#797979".to_string(),
                at_color: "#797979".to_string(),
                switch_theme_background: "#323232".to_string(),
                switch_theme_link_color: "#F5F5F5".to_string(),
                switch_theme_active: "#d02474".to_string(),
                switch_theme_border: "#49483E".to_string(),
                change_theme_link_color: "#F5F5F5".to_string(),
                change_theme_link_color_hover: "#F5F5F5".to_string(),
                upload_text_color: "#323232".to_string(),
                upload_form_border_color: "#d2d2d2".to_string(),
                upload_form_background: "#f2f2f2".to_string(),
                upload_button_background: "#d02474".to_string(),
                upload_button_text_color: "#FFFFFF".to_string(),
                drag_background: "#3333338f".to_string(),
                drag_border_color: "#ffffff".to_string(),
                drag_text_color: "#ffffff".to_string(),
                size_background_color: "#323232".to_string(),
                size_text_color: "#FFFFFF".to_string(),
                error_color: "#d02424".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 upload_text_color: String,
    pub upload_form_border_color: String,
    pub upload_form_background: String,
    pub upload_button_background: String,
    pub upload_button_text_color: String,
    pub drag_background: String,
    pub drag_border_color: String,
    pub drag_text_color: String,
    pub size_background_color: String,
    pub size_text_color: String,
    pub error_color: String,
}