1use ratatui::style::{Color, Modifier, Style};
7use ratatui::widgets::BorderType;
8
9#[derive(Debug, Clone, Copy)]
13pub struct AppTheme {
14 pub primary: Color,
16
17 pub success: Color,
19 pub warning: Color,
20 pub danger: Color,
21 pub info: Color,
22
23 pub text_primary: Color,
25 pub text_secondary: Color,
26 pub text_muted: Color,
27
28 pub border_active: Color,
30 pub border_inactive: Color,
31
32 pub bg_selected: Color,
34 pub bg_header: Color,
35}
36
37impl Default for AppTheme {
38 fn default() -> Self {
39 Self::dark()
40 }
41}
42
43impl AppTheme {
44 #[must_use]
46 pub const fn dark() -> Self {
47 Self {
48 primary: Color::Rgb(34, 211, 238), success: Color::Rgb(74, 222, 128), warning: Color::Rgb(251, 191, 36), danger: Color::Rgb(248, 113, 113), info: Color::Rgb(96, 165, 250), text_primary: Color::Rgb(248, 250, 252), text_secondary: Color::Rgb(148, 163, 184), text_muted: Color::Rgb(100, 116, 139), border_active: Color::Rgb(34, 211, 238), border_inactive: Color::Rgb(71, 85, 105), bg_selected: Color::Rgb(51, 65, 85), bg_header: Color::Rgb(30, 41, 59), }
70 }
71
72 #[must_use]
74 pub const fn light() -> Self {
75 Self {
76 primary: Color::Rgb(6, 182, 212), success: Color::Rgb(22, 163, 74), warning: Color::Rgb(217, 119, 6), danger: Color::Rgb(220, 38, 38), info: Color::Rgb(37, 99, 235), text_primary: Color::Rgb(15, 23, 42), text_secondary: Color::Rgb(71, 85, 105), text_muted: Color::Rgb(148, 163, 184), border_active: Color::Rgb(6, 182, 212), border_inactive: Color::Rgb(203, 213, 225), bg_selected: Color::Rgb(226, 232, 240), bg_header: Color::Rgb(241, 245, 249), }
98 }
99
100 #[inline]
104 #[must_use]
105 pub fn border_active_style(&self) -> Style {
106 Style::default().fg(self.border_active)
107 }
108
109 #[inline]
111 #[must_use]
112 pub fn border_inactive_style(&self) -> Style {
113 Style::default().fg(self.border_inactive)
114 }
115
116 #[inline]
118 #[must_use]
119 pub fn selected_style(&self) -> Style {
120 Style::default()
121 .bg(self.bg_selected)
122 .fg(self.text_primary)
123 .add_modifier(Modifier::BOLD)
124 }
125
126 #[inline]
128 #[must_use]
129 pub fn title_style(&self) -> Style {
130 Style::default()
131 .fg(self.primary)
132 .add_modifier(Modifier::BOLD)
133 }
134
135 #[inline]
137 #[must_use]
138 pub fn header_style(&self) -> Style {
139 Style::default().bg(self.bg_header)
140 }
141}
142
143pub const BORDER_TYPE: BorderType = BorderType::Rounded;