~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A host's operator picks the console's palette as PALETTE

Merged
Merged chadtmiller.com asked to merge into feature/branding from chadtmiller.com/group-host:branding/palette

The operator's set of colours is now PALETTE (was THEME), so "theme" no longer names two things: the reader's light or dark (data-theme) and the operator's palette. The console now marks the palette with <html data-palette>, set by the server hook, in place of a <meta name="theme"> matched by :has().

Claude Opus 5.5 · medium effort

What changes

The variable. THEME is PALETTE (GROUP_HOST_PALETTE in compose), with the same values, paper or slate. The host refuses any other value as before: "PALETTE is one of paper, slate, not neon". Brand.theme/THEMES are Brand.palette/PALETTES, and org.atgrp.internal.getBrand answers palette in place of theme. The lexicon isn't published yet, and just lex passes.

The page. The root layout's server load (+layout.server.ts) now reads getBrand, so +layout.ts no longer does. The server load puts the palette in event.locals.palette, and the hook's transformPageChunk writes data-palette="slate" on <html>, as it already writes data-theme for the reader's choice. Only a palette the console has gets in (paletteOf in #lib/brand.ts), and paper sets nothing. tokens.css selects slate by :root[data-palette='slate'].

The changeset already on this branch (host-colours.md) now says PALETTE and palette.

Changeset: none

Why

On main, data-theme means the reader's light or dark. Calling the operator's palette THEME too gave selectors like :root:has(meta[name='theme'][content='slate'])[data-theme='dark'], with "theme" meaning two things. Renaming is free until getBrand is published. An attribute set by the server is the usual way to switch a set of tokens, where theme is no standard meta name. The reference PDS has no setting like this (only PDS_PRIMARY_COLOR and the state colours), so there's no name to match.

How it was checked

  • just t --test config --test brand: 11 passed, renamed variable and field included.
  • npm run check (svelte-check, warnings failing): 0 errors.
  • just lex, just fmt.
  • PALETTE=slate PRIMARY_COLOR=#0f766e just look / --all: slate's cool paper, light and dark, with the teal button (pictures attached). Only the server sets the attribute, so slate showing means it arrived in the first byte.

Shortcomings

getBrand is now read by the server load before the universal load asks getViewer, one local request after the other where they used to run side by side. A host's brand doesn't change while it runs, so the console could keep it, but that's left for later.

home-desktop-light.png

home-phone-dark.png

Approved

This renames the operator's THEME to PALETTE. It does the same across Brand, the getBrand lexicon, compose, the docs and the tests. The console now marks the palette with a server-set <html data-palette> instead of a <meta> matched by :has().

I read every changed file and found nothing that must change.

  • Attribute value: paletteOf only lets a known palette through (Object.hasOwn(INKS, …)), so nothing arbitrary reaches the attribute.
  • Timing: palette() is evaluated inside transformPageChunk, after the layout server load has set locals.palette. The ordering the hook comment describes holds.
  • Specificity: :root[data-palette='slate'] has the same specificity the :has(meta…) selector had, so it still beats [data-theme='light'].
  • Load split: moving getBrand into +layout.server.ts and passing it through event.data.brand in +layout.ts is consistent. The extra serial request is already named in the body's shortcomings.

If getBrand fails, UNBRANDED gives no palette, so the page falls back to paper rather than erroring. That matches the old behaviour.

Merged as ab7d8ba