use crate::model::Status;
use ratatui::style::{Color, Modifier, Style};
pub const BORDER: Color = Color::Rgb(125, 150, 165); pub const BORDER_DIM: Color = Color::Rgb( 70, 85, 95); pub const FG: Color = Color::Rgb(225, 222, 215); pub const FG_DIM: Color = Color::Rgb(165, 170, 178); pub const HL_BG: Color = Color::Rgb( 50, 85, 120);
pub const GROUP_TINT_A: Color = Color::Rgb(16, 18, 22); pub const GROUP_TINT_B: Color = Color::Rgb(12, 14, 18);
pub fn group_tint(i: usize) -> Color {
if i % 2 == 0 { GROUP_TINT_A } else { GROUP_TINT_B }
}
pub const C_BUSY: Color = Color::Rgb(120, 215, 150); pub const C_SPAWN: Color = Color::Rgb(140, 215, 185); pub const C_ACTIVE: Color = Color::Rgb(195, 210, 130); pub const C_IDLE: Color = Color::Rgb(195, 195, 195); pub const C_WAIT: Color = Color::Rgb(225, 175, 110); pub const C_DONE: Color = Color::Rgb(200, 175, 215); pub const C_STALE: Color = Color::Rgb(110, 105, 108);
pub const C_CHART_CPU: Color = Color::Rgb(225, 195, 140); pub const C_CHART_MEM: Color = Color::Rgb(200, 175, 215); pub const C_CHART_TOK: Color = Color::Rgb(180, 200, 215);
pub const C_GAUGE_USED: Color = Color::Rgb(160, 200, 150); pub const C_GAUGE_AGENT: Color = Color::Rgb(225, 195, 140); pub const C_GAUGE_FREE: Color = Color::Rgb( 60, 65, 75);
pub fn status_color(s: Status) -> Color {
match s {
Status::Busy => C_BUSY,
Status::Spawning => C_SPAWN,
Status::Active => C_ACTIVE,
Status::Idle => C_IDLE,
Status::Waiting => C_WAIT,
Status::Completed => C_DONE,
Status::Stale => C_STALE,
}
}
pub fn status_style(s: Status) -> Style {
let st = Style::default().fg(status_color(s));
if matches!(s, Status::Busy | Status::Spawning) {
st.add_modifier(Modifier::BOLD)
} else if matches!(s, Status::Stale) {
st.add_modifier(Modifier::DIM)
} else {
st
}
}
pub fn agent_color(label: &str) -> Color {
match label {
"claude" | "claude-code" => Color::Rgb(160, 180, 215), "codex" | "openai-codex" => Color::Rgb(160, 200, 150), "aider" => Color::Rgb(220, 160, 155), "cursor-agent" => Color::Rgb(200, 170, 210), "gemini" => Color::Rgb(165, 215, 210), "goose" | "block-goose" => Color::Rgb(225, 195, 140), "continue" => Color::Rgb(225, 222, 215), "opencode" => Color::Rgb(200, 170, 210), "copilot" => Color::Rgb(165, 215, 210), "cody" => Color::Rgb(200, 170, 210), "amp" => Color::Rgb(225, 195, 140), "crush" => Color::Rgb(220, 160, 155), "mods" => Color::Rgb(160, 200, 150), "sgpt" => Color::Rgb(160, 180, 215), "llm" => Color::Rgb(165, 215, 210), "ollama" => Color::Rgb(225, 195, 140), "fabric" => Color::Rgb(225, 222, 215), _ => {
let palette = [
Color::Rgb(165, 215, 210), Color::Rgb(200, 170, 210), Color::Rgb(225, 195, 140),
Color::Rgb(220, 160, 155), Color::Rgb(160, 200, 150), Color::Rgb(160, 180, 215),
];
let mut h: u32 = 0;
for b in label.bytes() { h = h.wrapping_mul(31).wrapping_add(b as u32); }
palette[(h as usize) % palette.len()]
}
}
}
pub fn cpu_color(v: f64) -> Color {
if !v.is_finite() || v < 0.0 { return FG_DIM; } if v >= 50.0 { Color::Rgb(220, 160, 155) } else if v >= 10.0 { Color::Rgb(235, 180, 110) } else if v >= 1.0 { Color::Rgb(160, 200, 150) } else { FG_DIM }
}