feat: state platform metrics and chrome in theme

This commit is contained in:
2026-11-07 14:13:15 +07:00
parent 9e378ff7ff
commit d696b1e707
12 changed files with 574 additions and 73 deletions
+17 -8
View File
@@ -9,18 +9,20 @@ is the first downstream consumer; its screens drive the order.
## Next
- [ ] **Platform metric adoption** — update components one at a time
through the review gate against the landed theme tokens. The stated
metrics and the radius ladder already flow through the size table,
so each stop covers border + focus chrome (`Theme::borders`), the
spacing unit (`Theme::spacing`), and the component's stated dims:
button (the API template) first, then input, select, menu, popover,
dialog, toast, tooltip, alert, combobox, command palette, switch;
per-platform targets in
[platform-metrics-audit.md](platform-metrics-audit.md).
## Queue — to follow
Gaps surfaced by the signed comparison; ordered by signed's usage.
- [ ] **Platform metric fidelity** — native-sizing pass over the theme and
components: stated `control_height` per platform (macOS 24 measured /
Windows 32 / GNOME ≈34 / KDE ≈33), Linux root font sizes (GNOME 14.67px,
KDE 13.33px), platform overlay/sm radii, per-source border + focus
policy (macOS/GNOME borderless fills, Windows/KDE 1px), titlebar
heights (GNOME 47), a theme spacing scale, switch/icon calibration;
ranked findings in
[platform-metrics-audit.md](platform-metrics-audit.md).
- [ ] **Virtual list** — generic virtualized variable-height rows with a
scroll handle, promoted from the editor views' pattern over gpui's
`list`; signed's PR lists and commit diff drive it.
@@ -55,6 +57,13 @@ Gaps surfaced by the signed comparison; ordered by signed's usage.
- [x] Platform sources — macOS (NSColor), Windows 11 (UISettings), GNOME
(portal), KDE (kdeglobals), Omarchy (colors.toml), neutral fallback;
live watchers for each
- [x] Platform metric fidelity — stated control/input/menu-row/switch
metrics and the full radius ladder per platform, Linux root fonts
(GNOME gsettings `font-name`, KDE `kdeglobals font=`), per-source
border + focus chrome (`Theme::borders`), and a per-platform spacing
unit (`Theme::spacing`); findings in
[platform-metrics-audit.md](platform-metrics-audit.md). Components
adopt the tokens one by one (see Next)
### icons (`crates/icons`)
+9 -3
View File
@@ -229,6 +229,10 @@ density is frozen at a macOS-ish tuning.
## Recommended changes, in priority order
Landed 2026-11 with two deviations: Omarchy is grouped with GNOME (it
styles its apps with adwaita), and macOS's titlebar is stated at the
measured 32pt rather than queried at runtime (28pt on older builds).
1. **State `control_height` per platform** — add `control_height:
Option<Pixels>` beside `input_height` on `SystemTheme`, reuse the
ratio-scaling pattern: macOS 24 (measured), Windows 32, GNOME ≈34, KDE
@@ -248,9 +252,11 @@ density is frozen at a macOS-ish tuning.
queried rather than a drifted floor (32 on current builds, 28 older);
Windows stays stated.
6. **Add a minimal spacing scale to `Theme`** driven by a per-platform base
unit (GNOME 6, KDE 4/6/8, others 4); route menu/popover paddings, menu
item min-height (GNOME 32), and the hardcoded `min_w_`/`max_w` values
through it.
unit (GNOME 6, KDE 4/6/8, others 4); route menu/popover paddings and menu
row min-heights through it — GNOME 32 (published), Windows ≈33 (padding
4/5 + a 20px Body line + 2px item margins), KDE ≈29 (max(font, 20px
floors) + 1 + 2×4); the hardcoded `min_w_`/`max_w` surface values stay
put — they are platform-invariant.
7. **Calibrate switches and icons per platform** — macOS 54×24, Windows
40×20 with 12px knob, KDE 36×18; icon 16 on macOS/Windows.