hyprstream_compositor/
theme.rs1use ratatui::style::{Color, Modifier, Style};
4use ratatui::text::{Line, Span};
5use ratatui::widgets::{Block, BorderType, Borders};
6
7pub const AMBER: Color = Color::Rgb(236, 201, 75);
9pub const CYAN: Color = Color::Rgb(0, 232, 252);
10pub const DIM: Color = Color::Rgb(112, 128, 160);
11pub const BG: Color = Color::Rgb(10, 10, 20);
12pub const BG_PANEL: Color = Color::Rgb(20, 20, 40);
13pub const BG_MODAL: Color = Color::Rgb(16, 16, 34);
15pub const LOCK_COLOR: Color = Color::Rgb(136, 170, 255);
17
18pub const CLOSE_BUTTON_WIDTH: u16 = 3;
22
23fn close_button() -> Line<'static> {
24 Line::from(Span::styled(" x ", Style::default().fg(DIM))).right_aligned()
25}
26
27pub fn window_block(title: Line<'_>, focused: bool) -> Block<'_> {
29 Block::new()
30 .borders(Borders::ALL)
31 .border_type(BorderType::Rounded)
32 .border_style(if focused {
33 border_focused_style()
34 } else {
35 border_style()
36 })
37 .title(title)
38 .title_top(close_button())
39 .style(Style::default().bg(BG))
40}
41
42pub fn modal_block(title: Line<'_>) -> Block<'_> {
44 Block::new()
45 .borders(Borders::ALL)
46 .border_type(BorderType::Rounded)
47 .border_style(border_focused_style())
48 .title(title)
49 .title_top(close_button())
50 .style(Style::default().bg(BG_MODAL))
51}
52
53pub fn input_block() -> Block<'static> {
55 Block::new()
56 .borders(Borders::ALL)
57 .border_type(BorderType::Rounded)
58 .border_style(input_border_style())
59 .style(Style::default().bg(BG_PANEL))
60}
61
62pub fn border_focused_style() -> Style {
63 Style::default().fg(CYAN)
64}
65
66pub fn input_border_style() -> Style {
67 Style::default().fg(Color::Rgb(68, 85, 102))
68}
69
70pub fn gutter_style() -> Style {
71 Style::default().fg(DIM)
72}
73
74pub fn title_style() -> Style {
77 Style::default().fg(AMBER).add_modifier(Modifier::BOLD)
78}
79
80pub fn tab_active() -> Style {
81 Style::default()
82 .fg(AMBER)
83 .bg(BG_PANEL)
84 .add_modifier(Modifier::BOLD)
85}
86
87pub fn tab_inactive() -> Style {
88 Style::default().fg(DIM).bg(BG)
89}
90
91pub fn status_style() -> Style {
92 Style::default().fg(DIM)
93}
94
95pub fn progress_filled() -> Style {
96 Style::default().fg(AMBER).bg(BG_PANEL)
97}
98
99pub fn border_style() -> Style {
100 Style::default().fg(DIM)
101}
102
103pub fn titlebar_style() -> Style {
104 Style::default().fg(CYAN).add_modifier(Modifier::BOLD)
105}
106
107pub fn titlebar_dim_style() -> Style {
108 Style::default().fg(DIM)
109}
110
111pub fn help_key() -> Style {
112 Style::default().fg(AMBER).add_modifier(Modifier::BOLD)
113}
114
115pub fn help_text() -> Style {
116 Style::default().fg(DIM)
117}