Files
RedBear-OS/local/recipes/system/cub/source/cub-tui/src/theme.rs
T

60 lines
1.5 KiB
Rust

use ratatui::style::{Color, Modifier, Style};
#[derive(Clone, Copy, Debug)]
pub struct RedBearTheme {
pub background: Color,
pub surface: Color,
pub accent: Color,
pub text: Color,
pub muted: Color,
pub success: Color,
pub warning: Color,
pub error: Color,
}
impl Default for RedBearTheme {
fn default() -> Self {
Self {
background: Color::Rgb(14, 14, 18),
surface: Color::Rgb(24, 24, 28),
accent: Color::Rgb(181, 36, 48),
text: Color::Rgb(244, 244, 244),
muted: Color::Rgb(170, 170, 176),
success: Color::Rgb(116, 199, 147),
warning: Color::Rgb(255, 191, 87),
error: Color::Rgb(239, 83, 80),
}
}
}
impl RedBearTheme {
pub fn base_style(self) -> Style {
Style::default().bg(self.background).fg(self.text)
}
pub fn muted_style(self) -> Style {
Style::default().bg(self.background).fg(self.muted)
}
pub fn status_style(self) -> Style {
Style::default().bg(self.surface).fg(self.text)
}
pub fn border_style(self) -> Style {
Style::default().fg(self.muted)
}
pub fn focused_border_style(self) -> Style {
Style::default()
.fg(self.accent)
.add_modifier(Modifier::BOLD)
}
pub fn selected_style(self) -> Style {
Style::default()
.bg(self.accent)
.fg(self.text)
.add_modifier(Modifier::BOLD)
}
}