use ratatui::style::Color;
pub struct Theme {
pub no_color: bool,
pub primary: Color,
pub accent: Color,
pub success: Color,
pub error: Color,
pub warning: Color,
pub text: Color,
pub text_dim: Color,
pub border: Color,
pub bg: Color,
pub bg_selected: Color,
pub surface: Color,
}
impl Default for Theme {
fn default() -> Self {
Self {
no_color: false,
primary: Color::Rgb(0, 184, 212),
accent: Color::Rgb(255, 193, 7),
success: Color::Rgb(76, 175, 80),
error: Color::Rgb(244, 67, 54),
warning: Color::Rgb(255, 152, 0),
text: Color::Rgb(224, 224, 224),
text_dim: Color::Rgb(120, 120, 120),
border: Color::Rgb(97, 97, 97),
bg: Color::Rgb(33, 33, 33),
bg_selected: Color::Rgb(42, 42, 55),
surface: Color::Rgb(60, 60, 72),
}
}
}
impl Theme {
pub fn detect() -> Self {
let no_color = std::env::var_os("NO_COLOR").is_some();
Self {
no_color,
..Self::default()
}
}
pub fn with_no_color(mut self, no_color: bool) -> Self {
self.no_color = self.no_color || no_color;
self
}
}