feat(ui,manager): looks: light / dark / device, palettes and styles, chosen in the manager's profile menu (platform-v2 step 6.15)

- @xenia/ui theme.js: a look = mode (light | dark | system) + palette (data-palette) + style (data-style); applyLook /
  getStoredLook (per device), 'system' resolved with matchMedia and followed live, so a palette is just a light and a
  dark token block; applyTheme kept for older callers (keeps palette and style)
- tokens.css: 'Palettes' (first: Nord, light + dark, every colour and the nav rail) and 'Styles' (first: sharp: small
  corners, 1.5px borders, flat cards); --x-border-width used by every component and Tailwind's 'border'
- contrast test: every palette in both modes (+ the nav rail); it caught the default rail's active item at 3.7:1 -> 5.5:1
- manager: the saved look applied at start (was light only); profile menu -> Look: Light / Dark / Device, Colours
  (Xenia, Nord), Shapes (Rounded, Sharp), applied at once and kept on this device
- e2e: manager_look.mjs (every page in light and dark, no large near-white area in dark, contact sheets; 'nord-sharp'
  adds that look; in run-all), manager.mjs 'look:' (dark at once, kept after a reload, Device follows the device)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 00:30:24 +02:00
co-authored by Claude Opus 5.5
parent f383060bad
commit 2b44d55f81
14 changed files with 468 additions and 38 deletions
+129 -3
View File
@@ -264,8 +264,8 @@
* product's colour whatever the venue's accent, and has a dark-mode version (6.15). */
:root {
--x-nav-bg-rgb: 17 94 89; /* the rail */
--x-nav-raised-rgb: 15 118 110; /* hover, an open group */
--x-nav-active-rgb: 13 148 136; /* the page you are on */
--x-nav-raised-rgb: 21 106 100; /* hover, an open group */
--x-nav-active-rgb: 15 118 110; /* the page you are on (white text: 5.5:1) */
--x-nav-line-rgb: 13 148 136; /* dividers, a group's left line */
--x-nav-ink-rgb: 255 255 255; /* text on the rail */
--x-nav-ink-2-rgb: 204 251 241; /* items */
@@ -280,6 +280,16 @@
--x-nav-ink-3: rgb(var(--x-nav-ink-3-rgb));
--x-nav-dot: rgb(var(--x-nav-dot-rgb));
}
[data-theme], [data-palette] {
--x-nav-bg: rgb(var(--x-nav-bg-rgb));
--x-nav-raised: rgb(var(--x-nav-raised-rgb));
--x-nav-active: rgb(var(--x-nav-active-rgb));
--x-nav-line: rgb(var(--x-nav-line-rgb));
--x-nav-ink: rgb(var(--x-nav-ink-rgb));
--x-nav-ink-2: rgb(var(--x-nav-ink-2-rgb));
--x-nav-ink-3: rgb(var(--x-nav-ink-3-rgb));
--x-nav-dot: rgb(var(--x-nav-dot-rgb));
}
[data-theme="dark"] {
--x-nav-bg-rgb: 4 47 46;
--x-nav-raised-rgb: 17 94 89;
@@ -295,6 +305,106 @@
}
}
/* ── Palettes (plan step 6.15) ──────────────────────────────────────────────
* A palette is the colours of a look: every colour token above (and the nav rail's), once for
* light and once for dark. data-theme is always light or dark (theme.js resolves "system"), so
* a palette is exactly two blocks. To add one (Tokyo Night, Solarized…): copy the nord blocks,
* change the values, add its name to PALETTES in theme.js and its label to the apps' texts; the
* contrast test (tests/contrast.test.mjs) checks it in both modes. A palette brings its own
* accent, so it wins over the venue's accent (data-venue-theme) while it is on.
* Nord: nordtheme.com (Polar Night, Snow Storm, Frost, Aurora), darkened / lightened where text
* needed the contrast. */
[data-palette="nord"] {
--x-canvas-rgb: 236 239 244;
--x-surface-rgb: 250 251 252;
--x-surface-2-rgb: 229 233 240;
--x-surface-3-rgb: 216 222 233;
--x-line-rgb: 216 222 233;
--x-line-strong-rgb: 174 184 202;
--x-ink-rgb: 46 52 64;
--x-ink-2-rgb: 59 66 82;
--x-ink-3-rgb: 76 86 106;
--x-success-rgb: 79 115 59;
--x-success-fg-rgb: 255 255 255;
--x-success-soft-rgb: 226 236 218;
--x-success-ink-rgb: 66 98 49;
--x-warning-rgb: 142 98 22;
--x-warning-fg-rgb: 255 255 255;
--x-warning-soft-rgb: 248 238 214;
--x-warning-ink-rgb: 122 83 16;
--x-danger-rgb: 166 72 82;
--x-danger-fg-rgb: 255 255 255;
--x-danger-soft-rgb: 246 224 226;
--x-danger-ink-rgb: 148 60 70;
--x-info-rgb: 76 106 146;
--x-info-fg-rgb: 255 255 255;
--x-info-soft-rgb: 222 231 242;
--x-info-ink-rgb: 59 85 120;
--x-special-rgb: 133 94 128;
--x-special-fg-rgb: 255 255 255;
--x-special-soft-rgb: 240 228 238;
--x-special-ink-rgb: 112 76 107;
--x-scrim-rgb: 46 52 64;
--x-accent-rgb: 76 106 146;
--x-accent-strong-rgb: 59 85 120;
--x-accent-fg-rgb: 255 255 255;
--x-accent-soft-rgb: 222 231 242;
--x-accent-ink-rgb: 59 85 120;
--x-nav-bg-rgb: 59 66 82;
--x-nav-raised-rgb: 67 76 94;
--x-nav-active-rgb: 76 106 146;
--x-nav-line-rgb: 76 86 106;
--x-nav-ink-rgb: 255 255 255;
--x-nav-ink-2-rgb: 229 233 240;
--x-nav-ink-3-rgb: 136 192 208;
--x-nav-dot-rgb: 136 192 208;
}
[data-palette="nord"][data-theme="dark"] {
--x-canvas-rgb: 46 52 64;
--x-surface-rgb: 59 66 82;
--x-surface-2-rgb: 67 76 94;
--x-surface-3-rgb: 76 86 106;
--x-line-rgb: 76 86 106;
--x-line-strong-rgb: 97 108 130;
--x-ink-rgb: 236 239 244;
--x-ink-2-rgb: 216 222 233;
--x-ink-3-rgb: 184 193 208;
--x-success-rgb: 163 190 140;
--x-success-fg-rgb: 46 52 64;
--x-success-soft-rgb: 64 82 66;
--x-success-ink-rgb: 193 214 176;
--x-warning-rgb: 235 203 139;
--x-warning-fg-rgb: 46 52 64;
--x-warning-soft-rgb: 88 79 61;
--x-warning-ink-rgb: 242 220 176;
--x-danger-rgb: 220 140 148;
--x-danger-fg-rgb: 46 52 64;
--x-danger-soft-rgb: 94 62 72;
--x-danger-ink-rgb: 236 184 189;
--x-info-rgb: 129 161 193;
--x-info-fg-rgb: 46 52 64;
--x-info-soft-rgb: 63 82 106;
--x-info-ink-rgb: 190 210 230;
--x-special-rgb: 190 155 184;
--x-special-fg-rgb: 46 52 64;
--x-special-soft-rgb: 85 68 90;
--x-special-ink-rgb: 222 200 218;
--x-scrim-rgb: 0 0 0;
--x-accent-rgb: 136 192 208;
--x-accent-strong-rgb: 143 188 187;
--x-accent-fg-rgb: 46 52 64;
--x-accent-soft-rgb: 55 79 94;
--x-accent-ink-rgb: 163 210 224;
--x-nav-bg-rgb: 46 52 64;
--x-nav-raised-rgb: 59 66 82;
--x-nav-active-rgb: 76 106 146;
--x-nav-line-rgb: 67 76 94;
--x-nav-ink-rgb: 255 255 255;
--x-nav-ink-2-rgb: 229 233 240;
--x-nav-ink-3-rgb: 136 192 208;
--x-nav-dot-rgb: 136 192 208;
}
/* ── Board (the kitchen display's design language, plan step 3.2b-2) ───────
* A dark board with light cards, for screens read from a distance (kitchen, bar,
* and any later "board" screen). Always dark: it doesn't follow data-theme; the
@@ -389,7 +499,8 @@
* resolved where they are declared, then inherited). */
:root,
[data-theme],
[data-venue-theme] {
[data-venue-theme],
[data-palette] {
--x-canvas: rgb(var(--x-canvas-rgb));
--x-surface: rgb(var(--x-surface-rgb));
--x-surface-2: rgb(var(--x-surface-2-rgb));
@@ -478,6 +589,7 @@
--x-radius-card: 16px; /* cards, popovers (rounded-2xl) */
--x-radius-dialog: 20px; /* dialogs, sheets */
--x-radius-full: 9999px;
--x-border-width: 1px; /* every component border and Tailwind's `border` */
/* Control heights: 44 px is the minimum touch target */
--x-control-sm: 36px;
@@ -511,6 +623,20 @@
--x-shadow-overlay: 0 24px 48px rgb(0 0 0 / 0.55), 0 8px 16px rgb(0 0 0 / 0.35);
}
}
/* ── Styles (plan step 6.15) ────────────────────────────────────────────────
* A style is the shape of the components, not their colours: corners, borders, depth (and
* could be the type or the density). Every component reads these tokens, so a style changes
* buttons, fields, cards, dialogs and pills everywhere at once. "rounded" is the default (the
* values above). To add one: a block like this, its name in STYLES (theme.js), its label. */
[data-style="sharp"] {
--x-radius-sm: 2px;
--x-radius-control: 4px;
--x-radius-card: 6px;
--x-radius-dialog: 8px;
--x-border-width: 1.5px;
--x-shadow-raised: none; /* flat cards: the border draws them */
}
@media (prefers-reduced-motion: reduce) {
:root {
--x-duration-fast: 0ms;