1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate::geometry::Color;
/// Visual style palette. Widgets read from this rather than hard-coding colors,
/// so the same widget code can render in different retro themes later.
#[derive(Clone)]
pub struct Theme {
pub background: Color,
pub face: Color,
pub highlight: Color,
pub shadow: Color,
pub border: Color,
pub text: Color,
pub disabled_text: Color,
/// Selected-item background — Win 3.1 dark navy blue.
pub highlight_bg: Color,
/// Selected-item foreground text color — white on Win 3.1.
pub highlight_text: Color,
/// Point size for all chrome text — labels, buttons, fields, list rows,
/// dropdowns, dialogs, and the menu bar. One value so the whole UI stays
/// visually consistent; content widgets that want a different size (e.g.
/// `TextEditor`) carry their own override.
pub font_size: f32,
}
impl Theme {
/// Default Windows 3.1 palette: white workspace, light-gray button face,
/// white highlight, mid-gray shadow, black outer border.
pub const fn windows_31() -> Self {
Self {
background: Color::WHITE,
face: Color::LIGHT_GRAY,
highlight: Color::WHITE,
shadow: Color::MID_GRAY,
border: Color::BLACK,
text: Color::BLACK,
disabled_text: Color::MID_GRAY,
highlight_bg: Color::NAVY,
highlight_text: Color::WHITE,
font_size: 13.0,
}
}
}
impl Default for Theme {
fn default() -> Self {
Self::windows_31()
}
}