Skip to main content

minifb_ui/
theme.rs

1use crate::color::Color;
2
3/// Application-wide color theme with dark and light presets
4#[derive(Clone, Copy)]
5pub struct Theme {
6    // Background
7    pub bg_primary: Color,
8    pub bg_secondary: Color,
9    pub bg_surface: Color,
10
11    // Text
12    pub text_primary: Color,
13    pub text_secondary: Color,
14    pub text_dim: Color,
15
16    // Accent
17    pub accent: Color,
18    pub accent_soft: Color,
19
20    // Borders / separators
21    pub border: Color,
22    pub separator: Color,
23    pub highlight: Color,
24
25    // Semantic
26    pub danger: Color,
27    pub warning: Color,
28    pub success: Color,
29
30    // Surfaces
31    pub surface: Color,
32    pub surface_hover: Color,
33}
34
35impl Theme {
36    pub fn dark() -> Self {
37        Self {
38            bg_primary: Color::from(0x0E1628),
39            bg_secondary: Color::from(0x060A14),
40            bg_surface: Color::from(0x1A1A2E),
41            text_primary: Color::from(0xE8E8F0),
42            text_secondary: Color::from(0x8888A0),
43            text_dim: Color::from(0x505068),
44            accent: Color::from(0x6C5CE7),
45            accent_soft: Color::rgba(108, 92, 231, 40),
46            border: Color::from(0x303050),
47            separator: Color::from(0x2A2A44),
48            highlight: Color::rgba(108, 92, 231, 25),
49            danger: Color::from(0xE05555),
50            warning: Color::from(0xEAB308),
51            success: Color::from(0x34C759),
52            surface: Color::from(0x1A1A2E),
53            surface_hover: Color::from(0x242440),
54        }
55    }
56
57    pub fn light() -> Self {
58        Self {
59            bg_primary: Color::from(0x6C9BCF),
60            bg_secondary: Color::from(0x3B6FA0),
61            bg_surface: Color::from(0xFFFFFF),
62            text_primary: Color::from(0x1A1A2E),
63            text_secondary: Color::from(0x5A5A70),
64            text_dim: Color::from(0x9090A8),
65            accent: Color::from(0x6C5CE7),
66            accent_soft: Color::rgba(108, 92, 231, 30),
67            border: Color::from(0xC8C8D8),
68            separator: Color::from(0xD0D0DC),
69            highlight: Color::rgba(108, 92, 231, 20),
70            danger: Color::from(0xE05555),
71            warning: Color::from(0xEAB308),
72            success: Color::from(0x34C759),
73            surface: Color::from(0xF0F0F8),
74            surface_hover: Color::from(0xE0E0EC),
75        }
76    }
77}