1use crate::framebuffer_types::RGBColor;
2
3#[derive(PartialEq, Default)]
4pub enum Themes {
5 #[default]
6 Standard,
7 Night,
8 Industrial,
9 Forest,
10 Royal,
11 }
13
14impl Themes {
15 pub fn from_str(name: &str) -> Option<Self> {
16 match name {
17 "Standard" => Some(Themes::Standard),
18 "Night" => Some(Themes::Night),
19 "Industrial" => Some(Themes::Industrial),
20 "Forest" => Some(Themes::Forest),
21 "Royal" => Some(Themes::Royal),
22 _ => None,
23 }
24 }
25}
26
27#[derive(Default)]
28pub struct ThemeInfo {
29 pub top: RGBColor,
30 pub background: RGBColor,
31 pub border_left_top: RGBColor,
32 pub border_right_bottom: RGBColor,
33 pub text: RGBColor,
34 pub top_text: RGBColor,
35 pub alt_background: RGBColor,
36 pub alt_text: RGBColor,
37 pub alt_secondary: RGBColor,
38}
39
40const THEME_INFOS: [(Themes, ThemeInfo); 5] = [
42 (Themes::Standard, ThemeInfo {
43 top: [0, 0, 128],
44 background: [192, 192, 192],
45 border_left_top: [255, 255, 255],
46 border_right_bottom: [0, 0, 0],
47 text: [0, 0, 0],
48 top_text: [255, 255, 255],
49 alt_background: [0, 0, 0],
50 alt_text: [255, 255, 255],
51 alt_secondary: [128, 128, 128],
52 }),
53 (Themes::Night, ThemeInfo {
54 top: [0, 0, 0],
55 background: [34, 34, 34],
56 border_left_top: [239, 239, 239],
57 border_right_bottom: [0, 0, 0],
58 text: [239, 239, 239],
59 top_text: [239, 239, 239],
60 alt_background: [0, 0, 0],
61 alt_text: [239, 239, 239],
62 alt_secondary: [128, 128, 128],
63 }),
64 (Themes::Industrial, ThemeInfo {
65 top: [40, 40, 40],
66 background: [160, 160, 160],
67 border_left_top: [255, 255, 255],
68 border_right_bottom: [0, 0, 0],
69 text: [0, 0, 0],
70 top_text: [255, 255, 255],
71 alt_background: [0, 0, 0],
72 alt_text: [255, 255, 255],
73 alt_secondary: [128, 128, 128],
74 }),
75 (Themes::Forest, ThemeInfo {
76 top: [0, 128, 0],
77 background: [192, 192, 192],
78 border_left_top: [255, 255, 255],
79 border_right_bottom: [0, 0, 0],
80 text: [0, 0, 0],
81 top_text: [255, 255, 255],
82 alt_background: [0, 0, 0],
83 alt_text: [255, 255, 255],
84 alt_secondary: [128, 128, 128],
85 }),
86 (Themes::Royal, ThemeInfo {
87 top: [128, 0, 128],
88 background: [192, 192, 192],
89 border_left_top: [255, 255, 255],
90 border_right_bottom: [0, 0, 0],
91 text: [0, 0, 0],
92 top_text: [255, 255, 255],
93 alt_background: [0, 0, 0],
94 alt_text: [255, 255, 255],
95 alt_secondary: [128, 128, 128],
96 }),
97 ];
99
100pub fn get_theme_info(theme: &Themes) -> Option<ThemeInfo> {
102 for pair in THEME_INFOS {
103 if &pair.0 == theme {
104 return Some(pair.1);
105 }
106 }
107 None
108}
109