Skip to main content

tmx/ui/
theme.rs

1use ratatui::style::{Color, Modifier, Style};
2
3use crate::project::ProjectType;
4
5// Catppuccin Mocha palette.
6pub const VIOLET: Color = Color::Rgb(0xcb, 0xa6, 0xf7);
7pub const PURPLE: Color = Color::Rgb(0x89, 0xb4, 0xfa);
8pub const GREEN: Color = Color::Rgb(0xa6, 0xe3, 0xa1);
9pub const RED: Color = Color::Rgb(0xf3, 0x8b, 0xa8);
10pub const YELLOW: Color = Color::Rgb(0xf9, 0xe2, 0xaf);
11pub const BLUE: Color = Color::Rgb(0x89, 0xb4, 0xfa);
12pub const ORANGE: Color = Color::Rgb(0xfa, 0xb3, 0x87);
13pub const MUTED: Color = Color::Rgb(0x6c, 0x70, 0x86);
14pub const SURFACE: Color = Color::Rgb(0x31, 0x32, 0x44);
15pub const TEXT: Color = Color::Rgb(0xcd, 0xd6, 0xf4);
16
17pub fn title_style() -> Style {
18    Style::default().fg(VIOLET).add_modifier(Modifier::BOLD)
19}
20
21pub fn selected_style() -> Style {
22    Style::default().fg(VIOLET).add_modifier(Modifier::BOLD)
23}
24
25pub fn normal_style() -> Style {
26    Style::default().fg(TEXT)
27}
28
29pub fn muted_style() -> Style {
30    Style::default().fg(MUTED)
31}
32
33pub fn branch_style() -> Style {
34    Style::default().fg(PURPLE)
35}
36
37pub fn dirty_style() -> Style {
38    Style::default().fg(YELLOW)
39}
40
41pub fn status_bar_style() -> Style {
42    Style::default().fg(MUTED).bg(SURFACE)
43}
44
45pub fn type_style(project_type: ProjectType) -> Style {
46    let color = match project_type {
47        ProjectType::Go => BLUE,
48        ProjectType::Node => GREEN,
49        ProjectType::Rust => ORANGE,
50        ProjectType::Python => YELLOW,
51        ProjectType::Generic => MUTED,
52    };
53    Style::default().fg(color)
54}