virtuoso_cli/tui/
theme.rs1use ratatui::style::Color;
2
3pub struct Theme {
6 pub no_color: bool,
7 pub primary: Color,
8 pub accent: Color,
9 pub success: Color,
10 pub error: Color,
11 pub warning: Color,
12 pub text: Color,
13 pub text_dim: Color,
14 pub border: Color,
15 pub bg: Color,
16 pub bg_selected: Color,
17 pub surface: Color,
18}
19
20impl Default for Theme {
21 fn default() -> Self {
22 Self {
23 no_color: false,
24 primary: Color::Rgb(0, 184, 212),
25 accent: Color::Rgb(255, 193, 7),
26 success: Color::Rgb(76, 175, 80),
27 error: Color::Rgb(244, 67, 54),
28 warning: Color::Rgb(255, 152, 0),
29 text: Color::Rgb(224, 224, 224),
30 text_dim: Color::Rgb(120, 120, 120),
31 border: Color::Rgb(97, 97, 97),
32 bg: Color::Rgb(33, 33, 33),
33 bg_selected: Color::Rgb(42, 42, 55),
34 surface: Color::Rgb(60, 60, 72),
35 }
36 }
37}
38
39impl Theme {
40 pub fn detect() -> Self {
42 let no_color = std::env::var_os("NO_COLOR").is_some();
43 Self {
44 no_color,
45 ..Self::default()
46 }
47 }
48
49 pub fn with_no_color(mut self, no_color: bool) -> Self {
51 self.no_color = self.no_color || no_color;
52 self
53 }
54}