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
+19
View File
@@ -0,0 +1,19 @@
import type { BuiltinTheme } from './index.ts';
// "Malfoid", a fan creation: Draco Malfoy written as a female character. The books win over fan art.
export const silverSerpent = {
id: 'silver-serpent' as const,
name: 'Silver Serpent',
legacyIds: ['malfoid'],
fonts: { ui: 'Corbel, "Segoe UI", "Helvetica Neue", Arial, sans-serif', prose: '"Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif', heading: '"Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif' },
variants: {
dark: {
bg: '#151c1b', 'bg-elevated': '#1d3029', 'bg-active': '#223a32', border: '#528f74',
text: '#e3e7eb', 'text-dim': '#bec8ce', 'text-strong': '#fff5d5',
accent: '#36e395', 'accent-2': '#c5d5e2', selection: '#13533a', 'item-selection-bg': '#13533aa6',
error: '#f44747', 'warn-hot': '#d68a00', warn: '#cca700', ok: '#89d185', special: '#c792ea',
'syntax-keyword': '#36e395', 'syntax-variable': '#e3e7eb', 'syntax-property': '#f4c6ae', 'syntax-constant': '#edc45f', 'syntax-punctuation': '#edc45f', 'syntax-string': '#a7e7c4', 'syntax-number': '#ffb79b',
'syntax-comment': '#bec8ce', 'syntax-type': '#ffffff', 'syntax-function': '#61dfbb',
},
},
} satisfies BuiltinTheme;