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