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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
//! Design tokens — the named, finite vocabulary of values everything else
//! refers to.
//!
//! Tokens are public `const` values, not a runtime struct. That means:
//!
//! - Reading the file once gives you the entire vocabulary.
//! - Components reference tokens by name (`tokens::CARD`) directly,
//! no theme handle threaded through every call.
//! - Constants are inlined and indistinguishable from any other f32/Color
//! at runtime — there's no `OnceLock` to initialize.
//!
//! Naming intentionally shadows shadcn/Tailwind so LLM training transfers:
//! `CARD`, `MUTED_FOREGROUND`, `RADIUS_LG`, `SPACE_3`, etc.
//!
//! ## Palette resolution
//!
//! [`Color`] tokens carry a `token: Some(name)` marker. The renderer
//! resolves each tokened color through the active [`crate::Palette`] at
//! paint time, so the rgba seen on screen tracks
//! [`crate::Theme`]`::palette()` rather than the constants in this file.
//! The constants here serve as the **fallback rgba** — used when a token
//! has no palette entry or when the host renders without a theme
//! (`draw_ops` with the default `Theme`, whose default palette mirrors
//! these constants exactly). The fallback values match the default
//! Aetna Dark palette, which is copied from shadcn/ui zinc dark; pick a
//! different palette at runtime via [`crate::Theme::with_palette`] or
//! [`crate::Theme::aetna_light`].
use crateColor;
// ---- Palette ----
//
// Color tokens carry the default Aetna Dark / shadcn zinc dark rgba as
// their compile-time fallback. Apps swap to a light palette at runtime via
// `Theme::aetna_light()` (see `crate::Palette` for the full token →
// rgba mapping for each palette).
// Core shadcn-shaped semantic colors.
pub const BACKGROUND: Color = token;
pub const FOREGROUND: Color = token;
pub const CARD: Color = token;
pub const CARD_FOREGROUND: Color = token;
pub const POPOVER: Color = token;
pub const POPOVER_FOREGROUND: Color = token;
pub const PRIMARY: Color = token;
pub const PRIMARY_FOREGROUND: Color = token;
pub const SECONDARY: Color = token;
pub const SECONDARY_FOREGROUND: Color = token;
pub const MUTED: Color = token;
pub const MUTED_FOREGROUND: Color = token;
pub const ACCENT: Color = token;
pub const ACCENT_FOREGROUND: Color = token;
pub const DESTRUCTIVE: Color = token;
pub const DESTRUCTIVE_FOREGROUND: Color =
token;
pub const BORDER: Color = token;
pub const INPUT: Color = token;
pub const RING: Color = token;
pub const SUCCESS: Color = token;
pub const SUCCESS_FOREGROUND: Color = token;
pub const WARNING: Color = token;
pub const WARNING_FOREGROUND: Color = token;
pub const INFO: Color = token;
pub const INFO_FOREGROUND: Color = token;
// Extension colors. These remain semantic, but they describe a specific
// component/domain rather than the reusable shadcn core palette.
pub const OVERLAY_SCRIM: Color = token;
/// Themed link color. Picked up automatically by `.link(url)` runs
/// (and any `RunStyle.link.is_some()` run, regardless of how it was
/// constructed). Distinct from `PRIMARY` so an underlined link reads
/// as a link, not an action accent — brighter on dark, darker on light.
pub const LINK_FOREGROUND: Color = token;
// ---- Spacing ----
//
// Spacing follows Tailwind's numeric scale so layout code reads like
// the UI examples LLMs have seen most often: `gap-3` is 12 px, `p-4`
// is 16 px, `mt-2` is 8 px, etc.
pub const SPACE_0: f32 = 0.0;
pub const SPACE_1: f32 = 4.0;
pub const SPACE_2: f32 = 8.0;
pub const SPACE_3: f32 = 12.0;
pub const SPACE_4: f32 = 16.0;
pub const SPACE_5: f32 = 20.0;
pub const SPACE_6: f32 = 24.0;
pub const SPACE_7: f32 = 28.0;
pub const SPACE_8: f32 = 32.0;
pub const SPACE_10: f32 = 40.0;
pub const SPACE_12: f32 = 48.0;
// ---- Pinned-pane sizing ----
//
// Conventional starting widths for a resizable sidebar (file tree,
// settings nav, inspector). Sourced from VS Code (~240px), Slack
// (~270px), and Finder (~250px) — wide enough that label content
// stays readable, narrow enough that the main work area still
// dominates. `_MIN` is the floor below which file/label content
// truncates badly; `_MAX` is the ceiling above which a sidebar
// stops being a sidebar.
pub const SIDEBAR_WIDTH: f32 = 256.0;
pub const SIDEBAR_WIDTH_MIN: f32 = 180.0;
pub const SIDEBAR_WIDTH_MAX: f32 = 480.0;
// ---- Control sizing ----
//
// Shared row height for input-tier controls — buttons, selects, text
// inputs, tabs, pagination, command-palette rows. Form layouts depend
// on these aligning across widget kinds, so the value lives at the
// token tier rather than each widget hardcoding 32.0. Use this when
// sizing a parent container that has to fit a control row, or when
// composing a new control-shaped widget.
//
// Matches Tailwind/shadcn `h-8` (32 px) — the default for `Button`,
// `Input`, `Select`, etc. Square icon-only controls (icon button,
// pagination cell) use this as both width and height.
pub const CONTROL_HEIGHT: f32 = 32.0;
// ---- Radius ----
pub const RADIUS_SM: f32 = 4.0;
pub const RADIUS_MD: f32 = 8.0;
pub const RADIUS_LG: f32 = 12.0;
pub const RADIUS_PILL: f32 = 999.0;
// ---- Scrollbar thumb (overlay indicator on scrollable viewports) ----
/// Visible thumb width when idle. Kept thin so it doesn't crowd
/// content; the hitbox is wider so the thumb still feels grabbable
/// (Fitts's law).
pub const SCROLLBAR_THUMB_WIDTH: f32 = 6.0;
/// Visible thumb width while hovered or being dragged. The thumb
/// expands toward the viewport interior so the cursor sits inside
/// it instead of pinning the right edge.
pub const SCROLLBAR_THUMB_WIDTH_ACTIVE: f32 = 10.0;
/// Track / thumb hitbox width — the column on the right edge that
/// accepts pointer presses for thumb-grab and click-to-page. Always
/// wider than the visible thumb (idle or active) so grabbing a
/// thin idle thumb is still easy. Matches the shadcn ScrollArea
/// track width convention.
pub const SCROLLBAR_HITBOX_WIDTH: f32 = 14.0;
pub const SCROLLBAR_TRACK_INSET: f32 = 2.0;
pub const SCROLLBAR_THUMB_MIN_H: f32 = 24.0;
/// Idle thumb fill — subtle on background/card.
pub const SCROLLBAR_THUMB_FILL: Color = token;
/// Active (hovered or dragged) thumb fill — fully opaque accent.
pub const SCROLLBAR_THUMB_FILL_ACTIVE: Color =
token;
// ---- Shadow (passed to renderer as a "level"; backend interprets) ----
pub const SHADOW_SM: f32 = 4.0;
pub const SHADOW_MD: f32 = 12.0;
pub const SHADOW_LG: f32 = 24.0;
// ---- Typography ----
//
// Font-size tokens are pairs, matching Tailwind's default type scale:
// a `text-sm` token is 14/20, `text-2xl` is 24/32, and so on. Text
// roles should choose one of these tokens rather than setting a raw
// font size and letting measurement infer a line height later.
pub const TEXT_XS: TypeToken = TypeToken ;
pub const TEXT_SM: TypeToken = TypeToken ;
pub const TEXT_BASE: TypeToken = TypeToken ;
pub const TEXT_LG: TypeToken = TypeToken ;
pub const TEXT_XL: TypeToken = TypeToken ;
pub const TEXT_2XL: TypeToken = TypeToken ;
pub const TEXT_3XL: TypeToken = TypeToken ;
// ---- Icons ----
//
// Common lucide/shadcn icon boxes. `ICON_SM` is Tailwind `size-4`;
// `ICON_XS` maps to the common `size-3.5` treatment used in dense
// cells and compact status rows.
pub const ICON_XS: f32 = 14.0;
pub const ICON_SM: f32 = 16.0;
pub const ICON_MD: f32 = 20.0;
// ---- State styling ----
//
// Visual deltas applied when an element is in a non-default interaction
// state. Renderer consumes these.
/// How much to darken a fill on press, as a 0..1 factor.
pub const PRESS_DARKEN: f32 = 0.12;
/// How much to lighten a fill on hover, as a 0..1 factor.
pub const HOVER_LIGHTEN: f32 = 0.06;
/// Peak alpha contribution from a fully-eased hover envelope on a
/// surface with no resting fill (`.ghost()`, inactive tab triggers,
/// `.outline()`). Hover/press envelopes only modulate an existing
/// fill, so without a synthesized state-only fill these surfaces show
/// no interaction feedback. Mirrors the shadcn idiom
/// `hover:bg-accent active:bg-accent/80` — transparent at rest, a faint
/// raised surface fades in on interaction.
pub const STATE_FILL_HOVER_ALPHA: f32 = 0.40;
/// Additional peak alpha contribution from a fully-eased press
/// envelope. Sums with [`STATE_FILL_HOVER_ALPHA`] (clamped to 1.0) so
/// a press while hovered reads slightly more committed than hover
/// alone, but still quieter than the active/current treatment.
pub const STATE_FILL_PRESS_ALPHA: f32 = 0.25;
/// Opacity multiplier when an element is disabled.
pub const DISABLED_ALPHA: f32 = 0.5;
/// Ring outset (additional focus stroke beyond the element bounds).
pub const RING_WIDTH: f32 = 2.0;
/// Background tint for selected text in `text_input` / `text_area`.
/// Tinted accent at low alpha so glyphs stay readable through the
/// selection rectangle.
pub const SELECTION_BG: Color = token;
/// Selection-band fill applied while a text input lacks focus. A
/// neutral, low-saturation cousin of [`SELECTION_BG`]; the painter
/// lerps from this toward `SELECTION_BG` as the input regains focus
/// (see [`crate::tree::El::dim_fill`]). Matches the macOS convention
/// where unfocused selection reads as gray rather than blue.
pub const SELECTION_BG_UNFOCUSED: Color = token;