Two layers, as the spikes' report settled:
1. `VoelinTheme`, a GPUI global (theme/tokens.rs): the 43 colour tokens of
ui/theme.slint for light and dark (generated from the Slint file by a
script, then checked by the test below), the backdrop gradient, and
`Metrics`: the radii, spacing, type sizes, weights, control and shell
sizes and the two durations at a text size factor (font-scale: the
sidebar's `264 * max(1, scale)` and the top bar's `max(44, control + 8)`
included).
2. gpui-component's `ThemeColor`, written on every change (theme/components.rs):
the base of the report's table (background, foreground, border, input,
ring, overlay; primary with hover, active and foreground from the client's
accent; secondary and muted from surface-2 and its raised steps;
gpui-component's "accent", which is a hover background, from surface-3;
popover; list, table, sidebar, title and status bar, tabs, switch, slider,
scrollbar, link, selection; danger, success, warning and info with a hover
and active made by mixing and a text that is white or the window's ink,
whichever contrasts more) and the 28 `button_*` fields a theme file would
derive from them (without them the buttons keep the default theme's
blue). The mixing, the WCAG contrast and `readable` are `Rgba` methods with
tests. The window's background is bg-app; the backdrop and bg-rail stay in
`VoelinTheme` (gpui-component has no rail, and GPUI's gradient has two
stops against Slint's three: the swatch draws the first and the last and
says so).
The mode (`Choice`: system, light, dark) follows the window's appearance in
`system` (`observe_window_appearance` calls `set_system_appearance`; a light
or dark choice ignores the window) and sets the platform's window appearance
where the platform draws the frame (macOS; a no-op elsewhere). The text size
factor rewrites the metrics, the theme's font size (font-body) and radii.
theme/slint_parity.rs reads ui/theme.slint at test time (`include_str!`) and
compares every declaration of the `Theme` global with tokens.rs by name: the
colours (dark and light), every length with the file's own arithmetic (a
small evaluator of `*`, `+`, `max()` and token references) at four text
sizes, the weights, durations, the font family and the backdrop's stops, and
fails on a name on one side only or a declaration kind it does not know. A
mutation check (accent, radius-md and the top bar's formula changed in
tokens.rs) failed the tests with the names of the tokens, then was reverted.
fonts.rs adds the five Inter TTFs of the Slint front end (`include_bytes!`)
to GPUI's text system; the theme names the family. build.rs turns the 147
Lucide 1.48 SVGs of crates/voelin-ui/ui/assets/icons into a sorted table of
`include_bytes!` (std only, no new dependency) that assets.rs serves as
gpui-component's `icons/<name>.svg` before gpui-kit-assets' Lucide 1.43
catalogue (1,830 paths, which answers the rest and, as it does, an error for
a path it lacks); a test checks that `mic.svg` is the client's, differs from
the catalogue's, and that other icons fall through.
Development switches (dev.rs): `VOELIN_OPEN=swatch`, `VOELIN_DEV_THEME=
dark|light|system`, `VOELIN_FONT_SCALE`, `VOELIN_WINDOW_SIZE` (the Slint
front end's names where they exist). swatch.rs is the page: the 43 colours in
the groups of docs/ui.md's "Theme tokens" table with name and value (a test
checks each token is in exactly one group), the backdrop, radii, spacing,
the type scale, buttons, switches and checkboxes of gpui-component and 16
icons; it scrolls when the window is smaller. scripts/gpui-shot.sh makes the
screenshot headless the way scripts/shots.sh does for Slint (xvfb-run, or
GPUI_SHOT_HEADLESS=1 under headless.sh on NixOS; Wayland, the session bus
and the XDG directories out of the environment), then closes the window with
Alt+F4 and reports how the app ended. docs/ui/gpui-swatch-dark.png and
-light.png are its output (Xvfb :97, openbox, lavapipe via wgpu's Vulkan
backend, the debug binary, 1440x960, truecolour: a 256-colour reduction would
change the tokens' values; the Slint pictures live in docs/screenshots/, the
task asked for docs/ui/).
Checked on Rust 1.95.0: fmt, clippy -D warnings --no-deps (all targets, the
build script included), `cargo test -p voelin-gpui` 26 tests, cargo deny,
`scripts/notices.sh --check`.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>