Skip to content

WIP: theme presets (spec for app-first build; do not merge) - #713

Draft
jaspertey wants to merge 3 commits into
mainfrom
feat/theme-presets
Draft

jaspertey wants to merge 3 commits into
mainfrom
feat/theme-presets

Conversation

@jaspertey

@jaspertey jaspertey commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

WIP: spec for an app-first build. Do not merge. The owner has decided to build theme presets in an app first and graduate them to the kit later. This branch is the reference spec.

Done

  • Tey\Kit\Themes\Preset (readonly) and the Themes resolver (inventory from resources/themes/*.php + kit.themes.paths; offered(), default(), switched(), active()).
  • 14 presets with neutral names. Stable: community-paper, funky-retro, ink-gold, market-grotesk, soft-studio, sunny-commons. Draft: retro-sunburst, retro-marquee, retro-cooper, retro-groovy, retro-evening, retro-sunny, dm-civic, sunny-dm.
  • kit.themes.default (KIT_THEME), offered, switch_envs and paths. The preset in force merges into Brand::tokens()/css(), and Brand::tokens(null, $preset) lets mail/OG pass a workspace's preset.
  • The ?theme= session switch (?theme= clears it), hard-disabled in production, with drafts visible. kit:theme {name?}.
  • Fonts through <x-kit::fonts /> from Bunny (no Google URLs). The display face becomes --font-mark, applied only to the workspace and product name.
  • New kit.brand keys foreground, muted_foreground (+ _dark). header_rule accepts a list of 2 to 6 colours, printed as equal stripes (6px). The stripes are treated as decorative and exempt from contrast.
  • Themes::accessibilityProblems() checks WCAG 2.2 AA (4.5:1 for body, muted, link and button text; 3:1 for the button fill, focus ring and marker), light and dark. All 14 presets return an empty list.
  • Unthemed output is byte-identical to origin/main (tested against a fixture), plus docs/themes.md and a CHANGELOG entry.

Not done

  • test:themes is not updated for the 14-preset inventory and the ink-gold rename: the "offered" assertion currently fails.
  • No tests yet for the striped rule or fonts.tracking (recorded on the preset but not printed). Docs and the CHANGELOG don't mention dm-civic, sunny-dm or the stripes yet.
  • The full suite was not rerun after the last commit. CI on the previous commit failed in LibraryCheck because a broad Pint run had reformatted unrelated files; that is reverted in this commit.
  • Not built: dark navs (they need a header-highlight token), self-hosted preset faces, --radius, the preview page, the workspace setting and the MCP.

AA adjustments to picker colours

Preset Token From To Ratio (from → to)
market-grotesk accent (button, white text) #c2562f #b44f2a 4.50 → 5.13 (from is borderline 4.497)
retro-marquee accent (button) #c8442a #b83d25 4.87 → 5.63 (not needed; revert candidate)
retro-cooper accent (button) #b5521f #a84b1c 5.01 → 5.69 (not needed; revert candidate)
ink-gold accent_strong / page marker #deb100 #806600 1.94 → 5.27 on #fafafa
funky-retro accent_strong / page marker #f28c28 #a4520f 2.29 → 5.17 on #fdf6ee
retro-evening (light, new) accent (button) #f28c28 #b0561a 2.45 → 5.01 white text
market-grotesk, community-paper, dm-civic, sunny-commons, the retro drafts, sunny-dm header coloured/ink nav theme header + rule the accent as marker on ink is under 4.5:1 (e.g. community-paper 2.29)

All dark palettes are new and unreviewed.

…= dev switch, kit:theme

Six stable presets from the design picker and six Funky Retro round-2 drafts, each with
first-pass dark tokens that pass Brand::contrastProblems(). The preset in force merges into
Brand::tokens()/css() and loads its families through <x-kit::fonts /> from Bunny; its display
face is set on the workspace name. ?theme= keeps a preset for the session in
kit.themes.switch_envs and never in production. With no theme, output is byte-identical
(test:themes pins origin/main's output).
…e only on the workspace name

Themes::accessibilityProblems() checks 4.5:1 for body, muted, link and button text and 3:1 for
the button fill, focus ring and active marker, light and dark. Presets set foreground and
muted_foreground (new kit.brand keys, printed only when set). Appraisal and Funky Retro mark
the active item with accent_strong on the page. test:themes asserts the display face is set
only on the workspace and product name.
…, restore files Pint reformatted

Renames the picker's first preset to ink-gold and adds dm-civic and sunny-dm (draft).
header_rule accepts a list of 2 to 6 colours, printed as equal stripes. Reverts unrelated
src files that a broad Pint run had reformatted. test:themes is not yet updated for the
new inventory.
@jaspertey jaspertey changed the title Theme presets M1: Preset, Themes resolver, 12 presets, KIT_THEME, ?theme= switch, kit:theme WIP: theme presets (spec for app-first build; do not merge) Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant