euv_ui/theme/token/struct.rs
1use super::*;
2
3/// Complete semantic color palette resolved for a `(DesignScheme, ThemeMode)` pair.
4#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
5pub struct ThemePalette {
6 /// Application canvas background color.
7 #[get(type(copy))]
8 pub(crate) background: Color,
9 /// Primary foreground ink color.
10 #[get(type(copy))]
11 pub(crate) foreground: Color,
12 /// Elevated card and panel surface color.
13 #[get(type(copy))]
14 pub(crate) card: Color,
15 /// Card foreground ink color.
16 #[get(type(copy))]
17 pub(crate) card_foreground: Color,
18 /// Brand primary interactive fill color.
19 #[get(type(copy))]
20 pub(crate) primary: Color,
21 /// Foreground text color atop `primary`.
22 #[get(type(copy))]
23 pub(crate) primary_foreground: Color,
24 /// Subtle secondary control fill color.
25 #[get(type(copy))]
26 pub(crate) secondary: Color,
27 /// Foreground text color atop `secondary`.
28 #[get(type(copy))]
29 pub(crate) secondary_foreground: Color,
30 /// Muted container background color.
31 #[get(type(copy))]
32 pub(crate) muted: Color,
33 /// Muted label and helper text color.
34 #[get(type(copy))]
35 pub(crate) muted_foreground: Color,
36 /// Accent hover/selection highlight color.
37 #[get(type(copy))]
38 pub(crate) accent: Color,
39 /// Destructive action fill color.
40 #[get(type(copy))]
41 pub(crate) destructive: Color,
42 /// Foreground text color atop `destructive`.
43 #[get(type(copy))]
44 pub(crate) destructive_foreground: Color,
45 /// Positive / success semantic color.
46 #[get(type(copy))]
47 pub(crate) success: Color,
48 /// Foreground text color atop `success`.
49 #[get(type(copy))]
50 pub(crate) success_foreground: Color,
51 /// Warning semantic color.
52 #[get(type(copy))]
53 pub(crate) warning: Color,
54 /// Foreground text color atop `warning`.
55 #[get(type(copy))]
56 pub(crate) warning_foreground: Color,
57 /// Inactive toggle switch track color.
58 #[get(type(copy))]
59 pub(crate) switch_track_off: Color,
60 /// Toggle switch thumb fill color when inactive.
61 #[get(type(copy))]
62 pub(crate) switch_thumb: Color,
63 /// Dark cinema surface color used behind media, video, and canvas frames.
64 #[get(type(copy))]
65 pub(crate) media_surface: Color,
66 /// Standard 1px structural hairline border color.
67 #[get(type(copy))]
68 pub(crate) border: Color,
69 /// Keyboard focus ring outline color.
70 #[get(type(copy))]
71 pub(crate) ring: Color,
72 /// Modal / drawer scrim backdrop overlay color.
73 #[get(type(copy))]
74 pub(crate) overlay: Color,
75}
76
77/// Geometry, radius, control height, shadow ramp, and typography scale owned by a design scheme.
78#[derive(Clone, Copy, Data, Debug, PartialEq)]
79pub struct ThemeGeometry {
80 /// Small corner radius (badges, kbd).
81 #[get(type(copy))]
82 pub(crate) radius_sm: f32,
83 /// Medium corner radius (buttons, inputs).
84 #[get(type(copy))]
85 pub(crate) radius_md: f32,
86 /// Large corner radius (cards, popovers).
87 #[get(type(copy))]
88 pub(crate) radius_lg: f32,
89 /// Extra-large corner radius (modals, hero containers).
90 #[get(type(copy))]
91 pub(crate) radius_xl: f32,
92 /// Default structural border width.
93 #[get(type(copy))]
94 pub(crate) border_width: f32,
95 /// Focus ring stroke width.
96 #[get(type(copy))]
97 pub(crate) ring_width: f32,
98 /// Small control height.
99 #[get(type(copy))]
100 pub(crate) control_sm: f32,
101 /// Default control height.
102 #[get(type(copy))]
103 pub(crate) control_md: f32,
104 /// Large control height.
105 #[get(type(copy))]
106 pub(crate) control_lg: f32,
107 /// Body font size in logical pixels.
108 #[get(type(copy))]
109 pub(crate) font_body: f32,
110 /// Section heading font size.
111 #[get(type(copy))]
112 pub(crate) font_heading: f32,
113 /// Page title font size.
114 #[get(type(copy))]
115 pub(crate) font_title: f32,
116 /// Subtle control elevation shadow (buttons, switches, active pills).
117 #[get(type(copy))]
118 pub(crate) shadow_xs: Shadow,
119 /// Standard surface elevation shadow (cards, panels).
120 #[get(type(copy))]
121 pub(crate) shadow_sm: Shadow,
122 /// Floating surface elevation shadow (popovers, dropdowns, tooltips, toasts).
123 #[get(type(copy))]
124 pub(crate) shadow_md: Shadow,
125 /// High-elevation overlay shadow (modals, dialogs, drawers, hover cards).
126 #[get(type(copy))]
127 pub(crate) shadow_lg: Shadow,
128}
129
130/// Compact 2-byte theme identifier pairing a `DesignScheme` and `ThemeMode` for zero-copy static LUT lookup.
131#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
132pub struct ThemeKey {
133 /// Active design scheme (`1` byte).
134 #[get(type(copy))]
135 pub(crate) scheme: DesignScheme,
136 /// Active appearance mode (`1` byte).
137 #[get(type(copy))]
138 pub(crate) mode: ThemeMode,
139}
140
141/// Complete compiled cross-platform design token bundle passed across all UI components.
142#[derive(Clone, Copy, Data, Debug, PartialEq)]
143pub struct ThemeTokens {
144 /// Active design scheme.
145 #[get(type(copy))]
146 pub(crate) scheme: DesignScheme,
147 /// Active appearance mode (`Light` / `Dark`).
148 #[get(type(copy))]
149 pub(crate) mode: ThemeMode,
150 /// Resolved semantic color palette.
151 #[get(type(copy))]
152 pub(crate) palette: ThemePalette,
153 /// Resolved control geometry and typography scale.
154 #[get(type(copy))]
155 pub(crate) geometry: ThemeGeometry,
156}
157
158/// Paired `(background, foreground, border)` colors resolved for one `SurfaceRole`.
159///
160/// Components that change a container background MUST take the paired foreground from the same `SurfaceColors`
161/// so text can never become invisible against its surface.
162#[derive(Clone, Copy, Data, Debug, Eq, Hash, New, PartialEq)]
163pub struct SurfaceColors {
164 /// Surface fill color.
165 #[get(type(copy))]
166 pub(crate) bg: Color,
167 /// Foreground color guaranteed to reach `>= 4.5:1` contrast against `bg`.
168 #[get(type(copy))]
169 pub(crate) fg: Color,
170 /// Border color for the surface.
171 #[get(type(copy))]
172 pub(crate) border: Color,
173}