1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! Color themes and styling for the TUI
//!
//! Provides consistent color schemes and style utilities across the application.
use ratatui::style::{Color, Modifier, Style};
/// Application color theme
#[derive(Debug, Clone)]
pub struct Theme {
/// Primary accent color (used for highlights)
pub primary: Color,
/// Secondary accent color
#[allow(dead_code)]
pub secondary: Color,
/// Success color (green)
pub success: Color,
/// Error color (red)
pub error: Color,
/// Warning color (yellow)
pub warning: Color,
/// Info color (blue)
pub info: Color,
/// Progress color (cyan)
pub progress: Color,
/// Background color
#[allow(dead_code)]
pub background: Color,
/// Foreground/text color
pub foreground: Color,
/// Border color (normal state)
pub border: Color,
/// Border color (focused state)
pub border_focused: Color,
/// Selection/highlight color
#[allow(dead_code)]
pub selection: Color,
}
impl Default for Theme {
fn default() -> Self {
Self {
primary: Color::Cyan,
secondary: Color::Blue,
success: Color::Green,
error: Color::Red,
warning: Color::Yellow,
info: Color::Blue,
progress: Color::Cyan,
background: Color::Black,
foreground: Color::White,
border: Color::DarkGray,
border_focused: Color::Cyan,
selection: Color::DarkGray,
}
}
}
impl Theme {
/// Create a light theme variant
#[allow(dead_code)]
pub fn light() -> Self {
Self {
primary: Color::Blue,
secondary: Color::Cyan,
success: Color::Green,
error: Color::Red,
warning: Color::Yellow,
info: Color::Blue,
progress: Color::Cyan,
background: Color::White,
foreground: Color::Black,
border: Color::Gray,
border_focused: Color::Blue,
selection: Color::LightBlue,
}
}
/// Get style for normal text
pub fn text(&self) -> Style {
Style::default().fg(self.foreground)
}
/// Get style for dimmed text
pub fn text_dim(&self) -> Style {
Style::default().fg(Color::DarkGray)
}
/// Get style for title text
pub fn title(&self) -> Style {
Style::default()
.fg(self.primary)
.add_modifier(Modifier::BOLD)
}
/// Get style for success messages
pub fn success(&self) -> Style {
Style::default().fg(self.success)
}
/// Get style for error messages
pub fn error(&self) -> Style {
Style::default().fg(self.error).add_modifier(Modifier::BOLD)
}
/// Get style for warning messages
pub fn warning(&self) -> Style {
Style::default().fg(self.warning)
}
/// Get style for info messages
pub fn info(&self) -> Style {
Style::default().fg(self.info)
}
/// Get style for progress indicators
pub fn progress(&self) -> Style {
Style::default().fg(self.progress)
}
/// Get style for borders (normal)
pub fn border(&self) -> Style {
Style::default().fg(self.border)
}
/// Get style for borders (focused)
pub fn border_focused(&self) -> Style {
Style::default()
.fg(self.border_focused)
.add_modifier(Modifier::BOLD)
}
/// Get style for selected items
#[allow(dead_code)]
pub fn selected(&self) -> Style {
Style::default()
.bg(self.selection)
.add_modifier(Modifier::BOLD)
}
/// Get style for highlighted text
pub fn highlight(&self) -> Style {
Style::default()
.fg(self.primary)
.add_modifier(Modifier::BOLD)
}
/// Get style for dimmed/secondary text
pub fn dimmed(&self) -> Style {
Style::default()
.fg(Color::DarkGray)
.add_modifier(Modifier::DIM)
}
}