Skip to main content

carch_core/ui/
theme.rs

1use ratatui::style::Color;
2
3#[derive(Debug, Clone)]
4pub struct Theme {
5    pub name:       String,
6    pub background: Color,
7    pub foreground: Color,
8    pub primary:    Color,
9    pub secondary:  Color,
10    pub accent:     Color,
11    pub success:    Color,
12    pub warning:    Color,
13    pub error:      Color,
14}
15
16impl Theme {
17    // our beloved catppuccin_mocha
18    pub fn catppuccin_mocha() -> Self {
19        Self {
20            name:       "Catppuccin Mocha".to_string(),
21            background: Color::Rgb(30, 30, 46),
22            foreground: Color::Rgb(205, 214, 244),
23            primary:    Color::Rgb(137, 180, 250),
24            secondary:  Color::Rgb(173, 216, 190),
25            accent:     Color::Rgb(243, 139, 168),
26            success:    Color::Rgb(166, 227, 161),
27            warning:    Color::Rgb(250, 179, 135),
28            error:      Color::Rgb(243, 139, 168),
29        }
30    }
31
32    // for some vampire peoples
33    pub fn dracula() -> Self {
34        Self {
35            name:       "Dracula".to_string(),
36            background: Color::Rgb(40, 42, 54),
37            foreground: Color::Rgb(248, 248, 242),
38            primary:    Color::Rgb(189, 147, 249),
39            secondary:  Color::Rgb(139, 233, 253),
40            accent:     Color::Rgb(255, 121, 198),
41            success:    Color::Rgb(80, 250, 123),
42            warning:    Color::Rgb(241, 250, 140),
43            error:      Color::Rgb(255, 85, 85),
44        }
45    }
46
47    // for some people who *really* care about eyes
48    pub fn gruvbox() -> Self {
49        Self {
50            name:       "Gruvbox".to_string(),
51            background: Color::Rgb(40, 40, 40),
52            foreground: Color::Rgb(235, 219, 178),
53            primary:    Color::Rgb(250, 189, 47),
54            secondary:  Color::Rgb(184, 187, 38),
55            accent:     Color::Rgb(211, 134, 155),
56            success:    Color::Rgb(184, 187, 38),
57            warning:    Color::Rgb(254, 128, 25),
58            error:      Color::Rgb(204, 36, 29),
59        }
60    }
61
62    // our most soothing theme
63    pub fn nord() -> Self {
64        Self {
65            name:       "Nord".to_string(),
66            background: Color::Rgb(46, 52, 64),
67            foreground: Color::Rgb(236, 239, 244),
68            primary:    Color::Rgb(136, 192, 208),
69            secondary:  Color::Rgb(143, 188, 187),
70            accent:     Color::Rgb(180, 142, 173),
71            success:    Color::Rgb(163, 190, 140),
72            warning:    Color::Rgb(235, 203, 139),
73            error:      Color::Rgb(191, 97, 106),
74        }
75    }
76
77    // just some fancy name lovers
78    pub fn rose_pine() -> Self {
79        Self {
80            name:       "Rosé Pine".to_string(),
81            background: Color::Rgb(25, 23, 36),
82            foreground: Color::Rgb(224, 222, 244),
83            primary:    Color::Rgb(196, 167, 231),
84            secondary:  Color::Rgb(156, 207, 216),
85            accent:     Color::Rgb(235, 188, 186),
86            success:    Color::Rgb(49, 116, 143),
87            warning:    Color::Rgb(246, 193, 119),
88            error:      Color::Rgb(235, 111, 146),
89        }
90    }
91}