Color Locked in Three Token Layers: Alioth's Multi-Brand Theme System
A brand swap becomes a single generator input instead of a site-wide debugging hunt, because CI guards and generated artifacts catch regressions early. The unresolved SVG and Tailwind debts show tokenization only covers components that consume variables, a gap every multi-brand system will hit.
Multi-brand theming usually breaks in two structural ways: half the UI updates and half doesn't, or a brand switch makes button text unreadable. Alioth's web front end avoids both with a three-layer token system: layer 0 holds 15 brand palettes as :root[data-brand] selectors with 11-step color ramps and role colors; layer 1 maps brand roles to semantic variables like --primary; layer 2 maps those to component styles. Components only read semantic variables, so rebranding touches only layer 0.
Each brand color carries four distinct responsibilities: fill, foreground on fill, ink for text/icons, and focus ring. The generator derives all four from one brand hue in OKLCH space and bakes in WCAG contrast assertions, so an unreadable combination fails generation. Status colors (success, warning, danger) are decoupled from brand entirely to avoid confusion when brand hues collide with warning or success hues. Light/dark switching is driven by a class on <html> plus a data-brand attribute, not a media query, and a boot script in the head prevents first-frame flash by reading localStorage before stylesheets load.
Verification runs through generated artifacts and a conventions script: tokens:check compares generated CSS against the repo, and check-ui-conventions.mjs blocks new violations while ignoring legacy ones via a baseline file. Known debt remains: 169 Tailwind palette classes across 25 files, 181 instances of #1677ff inside unDraw SVGs that <img> can't recolor via CSS, and cross-device preference syncing that only uses localStorage. Manual checks cover button text, link/selected states, and focus rings; the design doc reports 360 contrast pairs across 15 brands × 2 modes × 12 semantic groups all pass, with a minimum of 4.55:1.
The decision to keep status colors out of the brand system is a deliberate tradeoff: visual consistency across brands loses to unambiguous semantics. Many design systems tie everything to brand, but Alioth argues that when warning and brand hues collide in hue space, users can't tell a brand accent from an alert.
The generator plus --check mode turns a CSS convention into a testable artifact, which makes hand-editing a single color value fail CI. That's more reliable than a 'don't edit by hand' comment.
The hardcoded brand list in the boot script shows that a clean abstraction (importable module) would cost a network request and break first-frame timing, so duplication with a consistency guard wins. Also the 169 Tailwind classes and 181 unDraw SVG colors are a reminder that tokenization only covers components that consume variables; images via <img> are a separate pipeline.