slog_html/
color_palette.rs1use slog::Level;
2
3pub struct ColorPalette {
5 pub critical: &'static str,
7
8 pub error: &'static str,
10
11 pub warning: &'static str,
13
14 pub info: &'static str,
16
17 pub debug: &'static str,
19
20 pub trace: &'static str,
22}
23
24impl ColorPalette {
25 pub fn level_to_color(&self, level: Level) -> &'static str {
27 use slog::Level::*;
28 match level {
29 Critical => self.critical,
30 Error => self.error,
31 Warning => self.warning,
32 Info => self.info,
33 Debug => self.debug,
34 Trace => self.trace,
35 }
36 }
37}
38
39impl Default for ColorPalette {
40 fn default() -> Self {
49 ColorPalette {
50 critical: "ff0000",
51 error: "ff5500",
52 warning: "ffaa00",
53 info: "55aa00",
54 debug: "55557f",
55 trace: "aaaa7f",
56 }
57 }
58}