Foundations
Themes
A theme is a seed: an accent colour, and if wanted a neutral tint, a radius scale and a density. tools/kui-theme.mjs derives every colour token for light and dark from it in OKLCH and refuses a theme whose text or controls fall under WCAG 2.2 AA contrast.
Choose a theme
Press a theme to apply it to this whole site. The mode (light, dark or as the device) is in the top bar.
Waiting for you
A card that asks the person, on the accent surface: open it.
Needs you
A warning
Warnings keep their own colour, away from the accent.
Make a product theme
Write a seed file and run the generator. It prints what it moved to reach contrast and fails with the pairs that are under AA.
{ "name": "harbour", "label": "Harbour", "accent": "#1f7a8c",
"neutral": { "hue": 220, "chroma": 0.006 }, "radius": "round", "density": "comfortable" }
node ui/tools/kui-theme.mjs --seed theme.json --out kit-theme.css
Load kit-theme.css after kui.css and set data-kui-theme="harbour" on the <html> element. Name the themes a person may choose in <meta name="kui-themes" content="harbour gold">; the theme picker offers only those.
What the generator does: the accent fill is the seed; the text on it is the gold theme's dark ink when that reads at 4.5:1, else a near white, and the hover moves the other way; the accent as text and as a surface keep the gold theme's lightness, so they keep its contrast, and are moved further when the seed needs it; in dark mode a seed that is too dark for the surface is lifted to a light fill. A status colour (ok, warn, danger, info) within 25 degrees of hue of the accent turns away from it. A neutral tint lays a small chroma on every grey at the same lightness.
A product's own character
A product seed may also name its fonts from the font catalog (with a fallback family for a script the first one lacks), up to six brand colours, the colour of headings and of labels, whether the page is white with tinted bands or the reverse, and the shape of its buttons. The generator writes the font faces and copies exactly the files they need (--fonts-out DIR), writes each brand colour with the text colour that reads on it in light and dark, and refuses what does not reach AA.
{ "name": "irvas", "accent": "#6b4226", "neutral": { "hue": 70, "chroma": 0.012 },
"fonts": { "display": "fraunces", "body": "source-sans-3", "scripts": ["latin", "latin-ext", "cyrillic"],
"fallback": { "cyrillic": { "display": "source-serif-4" } } },
"brand": { "deep": "#3b2416", "cream": "#faf6f0", "caramel": "#8a5a2b" },
"headings": "deep", "labels": "caramel", "page": "plain", "band": "cream", "button": "rounded" }
The business site recipe is built on a theme made this way.