use ratatui::style::{Color, Modifier, Style};
pub const BG: Color = Color::Rgb(11, 29, 40);
pub const BORDER: Color = Color::Rgb(15, 37, 53);
pub const DIM: Color = Color::Rgb(22, 46, 60);
pub const MUTED: Color = Color::Rgb(26, 58, 76);
pub const NORMAL: Color = Color::Rgb(37, 78, 98);
pub const BRIGHT: Color = Color::Rgb(56, 113, 127);
pub const HIGHLIGHT: Color = Color::Rgb(88, 160, 176);
pub const AMBER: Color = Color::Rgb(114, 88, 14);
pub const AMBER_BRIGHT: Color = Color::Rgb(150, 116, 20);
pub const REC_DIM: Color = Color::Rgb(90, 26, 26);
pub const REC_ACTIVE: Color = Color::Rgb(180, 50, 50);
pub const TRACK_COLORS: &[Color] = &[
Color::Rgb(56, 148, 142), Color::Rgb(108, 130, 60), Color::Rgb(140, 100, 50), Color::Rgb(80, 110, 160), Color::Rgb(130, 80, 130), Color::Rgb(60, 140, 100), Color::Rgb(150, 90, 70), Color::Rgb(70, 120, 140), ];
pub fn track_color(index: usize) -> Color {
TRACK_COLORS[index % TRACK_COLORS.len()]
}
pub fn bg() -> Style {
Style::default().bg(BG)
}
pub fn dim() -> Style {
Style::default().fg(DIM).bg(BG)
}
pub fn muted() -> Style {
Style::default().fg(MUTED).bg(BG)
}
pub fn normal() -> Style {
Style::default().fg(NORMAL).bg(BG)
}
pub fn amber() -> Style {
Style::default().fg(AMBER).bg(BG)
}
pub fn amber_bright() -> Style {
Style::default().fg(AMBER_BRIGHT).bg(BG)
}
pub fn branding() -> Style {
Style::default()
.fg(BRIGHT)
.bg(BG)
.add_modifier(Modifier::BOLD)
}
pub fn border_style() -> Style {
Style::default().fg(BORDER).bg(BG)
}
pub fn dim_color(c: Color, pct: u16) -> Color {
Color::Rgb((tc_r(c) as u16*pct/100) as u8, (tc_g(c) as u16*pct/100) as u8, (tc_b(c) as u16*pct/100) as u8)
}
pub fn tc_r(c: Color) -> u8 { if let Color::Rgb(r,_,_) = c { r } else { 128 } }
pub fn tc_g(c: Color) -> u8 { if let Color::Rgb(_,g,_) = c { g } else { 128 } }
pub fn tc_b(c: Color) -> u8 { if let Color::Rgb(_,_,b) = c { b } else { 128 } }
pub fn btn_style(active: bool, focused: bool, tc: Color) -> Style {
if active {
Style::default().fg(dim_color(tc, 80))
.bg(if focused { Color::Rgb(25,40,50) } else { Color::Rgb(12,22,32) })
.add_modifier(Modifier::BOLD)
} else if focused {
Style::default().fg(NORMAL).bg(Color::Rgb(25,40,50))
} else {
Style::default().fg(Color::Rgb(18,50,72)).bg(Color::Rgb(7,17,28))
}
}