ADR 0410: An owner describes a theme in words, and the Assistant may propose only colours, fonts and sizes the engine makes readable
Context#
A theme is a JSON file of tokens, which is easy for a developer and out of reach for an owner who can say "warm like my kitchen at Christmas, deep red and pine green, big easy-to-read writing" but not write a colour token. Customize look offers presets over one theme; an owner who wants a look of her own for a season needs a new theme. The Assistant can turn words into a proposal, as it already does for job drafts (ADR 0303), but a theme reaches every page, so what it may propose has to be small and checked.
Decision#
- The proposal is a closed shape.
label,summary,colorScheme, six colours (page,surface,text,muted,border,accent) for light and for dark as#rrggbb, andfont,headingFont,roundnessandtextSizefrom fixed lists (the look controls' safe font stacks, ADR 0248). Any other field, a colour that is not a hex colour, or a value outside its list rejects the whole proposal. There is no field for CSS, scripts, images, font files or decorations. - The engine finishes it.
openblog_core::theme_draftderives every other colour token, and moves any colour that carries text the least it takes to be readable onpageandsurface: body text to 7:1 where it can, never under 4.5:1; quieter text and the accent to 4.5:1; the text on the accent picked to 4.5:1. Each adjustment is returned as a sentence. - It extends a theme of the site's own. The owner chooses which (the site's own by default). The new theme keeps that theme's structure, stylesheets, decorations and components and changes only its tokens.
- The words are untrusted data. The
theme-draftAssistant task carries the description, the site title, the base theme's label and, for a change, the current draft, insideuntrustedData; the rules say they are never instructions. The output schema is strict. - Nothing is written until the owner saves, and saving only creates. Drafting and previewing write nothing;
the preview is the production home page in the draft, in memory, behind a one-time address. A save writes
themes/<new folder>/theme.jsonwith a folder name made from the label that no theme has, never replaces one, and never puts the theme on: the owner chooses it on Seasons.
Consequences#
- An owner can make a seasonal look herself, and it is readable by construction.
- The proposal cannot reach a page except as tokens the engine compiles, so a hostile description or a misbehaving provider can at worst propose ugly colours, which the preview shows before anything is saved.
- Decorations (garlands, pictures) are not drafted: an owner keeps them by starting from a theme that has them. Drawing decorations from words would need the engine to judge pictures, and is left out on purpose.