Give themes named color roles, theme data files, and file format 3

Phase 5a-1 and 5a-2.

- roles.ts names 51 color roles. One derivation rule fills the roles
  that a theme does not give, for all themes. tokens.css keeps only the
  root defaults, without theme blocks.
- Each built-in theme is one data file in src/lib/theme/themes/. No code
  outside the theme data names a theme ID. characterThemes.ts is gone.
- New roles: link, focus, on-accent, highlight, scrim, the syntax roles,
  and 16 terminal (ANSI) roles. Stray colors in components use the roles.
- contrast.ts checks each theme against the readability rules of
  docs/ui-color.md. The tests mark the known palette failures as todo,
  and a second test fails when a known failure starts to pass.
- Theme files use schema 3 with a mode and an optional built-in base.
  A short file gets the missing colors and fonts from the base. Schema 1
  and 2 files still import. Old syntax names convert on import.
- Docs: ui-color.md, plugin-development.md (theme tokens), ui-design.md,
  guides/themes.md, and UI-041 and UI-042 in design-decisions.md.

The applied colors stay the same for every built-in theme, except three
small changes: the conflict line uses the warn color, the Write
highlight uses the highlight role, and two dialog backdrops use the
scrim role.

pnpm check passes. pnpm test: 447 pass, 31 todo, 0 fail. Full smoke
suite: 93 passed, 2 known. appearance/palettes read the old syntax
names and passed 3 of 3 times after the fix. workspace/manageTemplates
failed one time and passed on retry.
This commit is contained in:
Knotty Wyvern
2026-10-28 15:50:45 -07:00
parent af68d92969
commit 5bd616d7fd
55 changed files with 928 additions and 355 deletions
+4 -3
View File
@@ -31,7 +31,8 @@ Do not copy feature-specific colors into a shared control.
| Undo, Redo, clipboard, and search rows | `src/lib/ui/menuItems.ts` |
| Menu and picker presentation | `src/lib/ui/menu.css` |
| Find | `src/lib/editor/FindPanel.svelte` and `src/lib/ui/find.css`. Write and Source search with `editorSearch.ts`. Read and plugin views search with `readingSearch.ts`. |
| Dimensions and colors | `src/lib/theme/tokens.css` |
| Dimensions and fixed colors | `src/lib/theme/tokens.css` |
| Theme colors | The roles in `src/lib/theme/roles.ts` and the theme data in `src/lib/theme/themes/`. See [Functional color](ui-color.md#roles-and-tokens). |
| Token | Default | Use |
| --- | --- | --- |
@@ -153,9 +154,9 @@ Decisions: [UI-004](design-decisions.md#ui-004--detached-tab-work-area), [UI-039
- Controls wrap at narrow widths, and the content area scrolls. Long navigation must leave room for the selected page.
- General offers the interface language through the shared action menu.
- The transparency slider covers 0% to 100% and uses the accent and surface tokens of the current theme.
- Custom theme templates use schema 2: one fixed `colors` palette and `fonts` stacks for interface, prose, headings, and code. A schema 1 import selects the palette of the current appearance.
- Custom theme files use schema 3: one `mode`, an optional built-in `base` theme, the `colors` that differ from the base, and `fonts` stacks for interface, prose, headings, and code. The export writes every color and font. Schema 1 and 2 imports convert to schema 3. A schema 1 import selects the palette of the current appearance.
Decisions: [UI-028](design-decisions.md#ui-028--adjustable-surface-transparency-and-fixed-custom-palettes).
Decisions: [UI-028](design-decisions.md#ui-028--adjustable-surface-transparency-and-fixed-custom-palettes), [UI-042](design-decisions.md#ui-042--theme-file-format-3-and-terminal-colors).
## Typography and tables