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:
@@ -1,3 +1,4 @@
|
||||
/* Defaults until ThemeSync applies the theme. src/lib/theme/roles.ts lists the color roles that each theme sets. */
|
||||
:root {
|
||||
--rs-selection-text: var(--rs-text);
|
||||
--rs-tooltip-padding: 6px 10px;
|
||||
@@ -57,6 +58,11 @@
|
||||
--rs-warn: #cca700;
|
||||
--rs-ok: #89d185;
|
||||
--rs-special: #c792ea;
|
||||
--rs-link: var(--rs-accent);
|
||||
--rs-focus: var(--rs-accent);
|
||||
--rs-on-accent: #000000;
|
||||
--rs-highlight: #edc65b;
|
||||
--rs-scrim: #00000088;
|
||||
|
||||
--rs-font-ui: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
|
||||
--rs-font-prose: "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
|
||||
@@ -86,44 +92,7 @@
|
||||
--rs-h4: var(--rs-text);
|
||||
--rs-h5: var(--rs-text-dim);
|
||||
--rs-h6: var(--rs-text-dim);
|
||||
}
|
||||
|
||||
[data-theme="light"] {
|
||||
--rs-bg: #f3f3f3;
|
||||
--rs-bg-elevated: #ffffff;
|
||||
--rs-bg-active: #e8e8e8;
|
||||
--rs-border: #d4d4d4;
|
||||
--rs-text-dim: #6b6b6b;
|
||||
--rs-text: #1e1e1e;
|
||||
--rs-text-strong: #111111;
|
||||
--rs-selection: #add6ff;
|
||||
--rs-line-highlight: #0000000d;
|
||||
}
|
||||
|
||||
[data-palette="claude"] {
|
||||
--rs-font-ui: "Lora", Georgia, serif;
|
||||
--rs-font-prose: "Lora", Georgia, serif;
|
||||
--rs-font-heading: "Poppins", Arial, sans-serif;
|
||||
}
|
||||
|
||||
[data-palette="sakura"], [data-palette="harvest-moon"], [data-palette="crimson-pilot"], [data-palette="silver-serpent"] {
|
||||
--rs-item-selection-bg: var(--rs-selection);
|
||||
}
|
||||
|
||||
[data-palette="harvest-moon"] {
|
||||
--rs-font-ui: Candara, "Trebuchet MS", "Segoe UI", sans-serif;
|
||||
--rs-font-prose: Constantia, Georgia, "Times New Roman", serif;
|
||||
--rs-font-heading: var(--rs-font-prose);
|
||||
}
|
||||
|
||||
[data-palette="crimson-pilot"] {
|
||||
--rs-font-ui: Bahnschrift, "Trebuchet MS", Arial, sans-serif;
|
||||
--rs-font-prose: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
|
||||
--rs-font-heading: var(--rs-font-ui);
|
||||
}
|
||||
|
||||
[data-palette="silver-serpent"] {
|
||||
--rs-font-ui: Corbel, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
|
||||
--rs-font-prose: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
|
||||
--rs-font-heading: var(--rs-font-prose);
|
||||
/* Fixed colors that do not change with the theme. */
|
||||
--rs-caption-close-bg: #c42b1c;
|
||||
--rs-image-viewer-bg: #090a0de8;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user