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
+2 -2
View File
@@ -67,12 +67,12 @@
.content[hidden] { display: none; }
ul { list-style: none; padding: 2px 6px 6px; margin: 0; }
.source { width: 100%; display: block; padding: 6px; border: 0; border-radius: var(--rs-control-radius); background: transparent; color: var(--rs-text); text-align: left; font: inherit; }
.source-title { display: flex; align-items: center; gap: 6px; color: var(--rs-accent); }
.source-title { display: flex; align-items: center; gap: 6px; color: var(--rs-link); }
.source-title > span:first-of-type { min-width: 0; overflow-wrap: anywhere; }
.line { margin-left: auto; color: var(--rs-text-dim); font-variant-numeric: tabular-nums; }
.excerpt { display: -webkit-box; line-clamp: 2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }
.toggle:hover, .source:hover { background: var(--rs-bg-active); }
.toggle:focus-visible, .source:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: -2px; }
.toggle:focus-visible, .source:focus-visible { outline: 2px solid var(--rs-focus); outline-offset: -2px; }
.placeholder, .error { margin: 8px 12px; font-size: 12px; overflow-wrap: anywhere; }
.placeholder { color: var(--rs-text-dim); }
.error { color: var(--rs-error); }
+1 -1
View File
@@ -56,7 +56,7 @@
<style>
dialog { margin-top: 12vh; width: min(640px, 85vw); }
dialog::backdrop { background: #0008; }
dialog::backdrop { background: var(--rs-scrim); }
input { width: 100%; padding: 16px; border: 0; background: var(--rs-bg); color: var(--rs-text-strong); }
.results { max-height: 50vh; overflow: auto; }
.file-detail { min-width: 0; overflow-wrap: anywhere; }
+2 -2
View File
@@ -178,7 +178,7 @@
<style>
dialog { width: min(920px, calc(100vw - 32px)); height: min(650px, calc(100dvh - 32px)); max-width: none; max-height: none; padding: 0; background: var(--rs-bg); color: var(--rs-text); border: 1px solid var(--rs-border); border-radius: 12px; box-shadow: 0 24px 80px #0008; overflow: hidden; }
dialog::backdrop { background: #0008; }
dialog::backdrop { background: var(--rs-scrim); }
dialog.standalone { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
dialog.help { width: min(650px, calc(100vw - 32px)); }
header { height: var(--rs-titlebar-height); padding: 0 4px 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rs-border); background: var(--rs-bg-elevated); }
@@ -187,7 +187,7 @@
.body { display: flex; height: calc(100% - var(--rs-titlebar-height)); min-height: 0; }
aside { width: 220px; flex-shrink: 0; padding: 12px 8px; background: var(--rs-bg-elevated); border-right: 1px solid var(--rs-border); display: flex; flex-direction: column; overflow: auto; }
.search { display: flex; gap: var(--rs-settings-gap); align-items: center; min-height: var(--rs-settings-control-height); background: var(--rs-bg-active); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); padding: 4px 8px; color: var(--rs-text-dim); }
.search:focus-within { outline: 2px solid var(--rs-accent); }
.search:focus-within { outline: 2px solid var(--rs-focus); }
.search input { width: 100%; min-width: 0; border: 0; padding: 0; outline: none; background: transparent; color: var(--rs-text); }
.nav-heading { margin: 16px 8px 6px; font-size: 11px; color: var(--rs-text-dim); }
nav { display: flex; flex-direction: column; gap: 2px; }
+2 -2
View File
@@ -67,12 +67,12 @@
<style>
dialog{width:min(600px,90vw);max-height:80vh;padding:var(--rs-settings-section-gap);background:var(--rs-bg);color:var(--rs-text);border:1px solid var(--rs-border);border-radius:var(--rs-control-radius)}
dialog::backdrop{background:#0008}
dialog::backdrop{background:var(--rs-scrim)}
header,.row,.actions,.new{display:flex;align-items:center;gap:var(--rs-settings-gap)}
header{justify-content:space-between}h2{margin:0;font-size:var(--rs-settings-heading-size)}
p{font-size:var(--rs-settings-description-size);color:var(--rs-text-dim);line-height:1.5}
.list{margin-top:var(--rs-settings-gap);max-height:50vh;overflow:auto}.row{padding:var(--rs-settings-row-padding);border-bottom:1px solid var(--rs-border);flex-wrap:wrap}.row>span{flex:1;min-width:100px;overflow-wrap:anywhere}
.new{min-height:var(--rs-settings-control-height);padding:4px 8px;background:var(--rs-bg-elevated);border:1px solid var(--rs-border);border-radius:var(--rs-control-radius)}
.new :global(svg){width:16px;height:16px}[role=alert]{color:var(--rs-error)}
.rename{display:flex;align-items:center;gap:4px;min-height:28px;padding:4px 8px;background:transparent;border:0;border-radius:var(--rs-control-radius)}.rename:hover{background:var(--rs-bg-active)}.rename:focus-visible{outline:2px solid var(--rs-accent)}.rename :global(svg){width:16px;height:16px}
.rename{display:flex;align-items:center;gap:4px;min-height:28px;padding:4px 8px;background:transparent;border:0;border-radius:var(--rs-control-radius)}.rename:hover{background:var(--rs-bg-active)}.rename:focus-visible{outline:2px solid var(--rs-focus)}.rename :global(svg){width:16px;height:16px}
</style>
+1 -1
View File
@@ -27,7 +27,7 @@
<style>
dialog { width: min(480px, 90vw); padding: 22px; background: var(--rs-bg-elevated); color: var(--rs-text); border: 1px solid var(--rs-border); }
dialog::backdrop { background: #0008; }
dialog::backdrop { background: var(--rs-scrim); }
form { display: flex; flex-direction: column; gap: 16px; }
input { width: 100%; background: var(--rs-bg); color: var(--rs-text-strong); border: 1px solid var(--rs-border); padding: 9px; }
form div { display: flex; justify-content: flex-end; gap: 8px; }
+1 -1
View File
@@ -1441,7 +1441,7 @@
.terminal-hidden { display: none !important; }
.terminal-maximized > .center, .terminal-maximized > .gutter-h { display: none; }
.terminal-maximized > .bottom { flex: 1; height: auto; }
.conflict { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; background: var(--rs-bg-active); border-bottom: 1px solid var(--rs-warning, #ebcb8b); }
.conflict { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; background: var(--rs-bg-active); border-bottom: 1px solid var(--rs-warn); }
.conflict span { flex: 1 1 300px; }
.conflict button { border: 1px solid var(--rs-border); background: var(--rs-bg); padding: 4px 8px; }
.disk-review { padding: 8px 12px; max-height: 35vh; overflow: auto; flex: 0 0 auto; }
+2 -2
View File
@@ -160,7 +160,7 @@
.recent { max-height: min(360px, 45vh); overflow: auto; }
form button { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; border-radius: var(--rs-control-radius); padding: 9px 10px; color: var(--rs-text); text-align: left; }
form button:hover { background: var(--rs-bg-active); }
form button:focus-visible, input:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: -2px; }
form button:focus-visible, input:focus-visible { outline: 2px solid var(--rs-focus); outline-offset: -2px; }
form button:disabled { opacity: .5; }
.workspace-row, footer button { width: 100%; }
.workspace-entry { display: flex; align-items: stretch; }
@@ -171,7 +171,7 @@
.current-label { font-size: 11px; color: var(--rs-accent); }
footer { border-top: 1px solid var(--rs-border); margin-top: 6px; padding-top: 6px; }
dialog { width: min(480px, calc(100vw - 32px)); padding: 22px; }
dialog::backdrop { background: #0008; }
dialog::backdrop { background: var(--rs-scrim); }
form { display: flex; flex-direction: column; gap: 12px; }
form h2, form p { padding: 0; margin: 0; }
form label { font-size: 13px; }
+2 -2
View File
@@ -37,7 +37,7 @@
.reading > :first-child { margin-top: 0; }
.reading p { margin: 0 0 .75em; white-space: pre-line; }
.reading strong { font-weight: 600; color: var(--rs-text-strong); }
.reading a { color: var(--rs-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.reading a { color: var(--rs-link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.reading a:hover { color: var(--rs-accent-2); }
.reading hr { border: 0; border-top: 1px solid var(--rs-border); margin: 2em 0; }
@@ -156,7 +156,7 @@
.reading .md-properties summary { padding: 9px 12px; cursor: pointer; }
.reading .md-properties summary:hover { color: var(--rs-text-strong); }
.reading .md-properties pre { margin: 0; padding: 12px; border: 0; border-top: 1px solid var(--rs-border); border-radius: 0 0 6px 6px; white-space: pre-wrap; }
.reading mark { background: color-mix(in srgb, #edc65b 30%, transparent); color: inherit; border-radius: 2px; }
.reading mark { background: color-mix(in srgb, var(--rs-highlight) 30%, transparent); color: inherit; border-radius: 2px; }
.reading .md-inline-math { font-family: var(--rs-font-mono); font-style: italic; }
.reading .md-inline-comment { display: none; }
.reading:not(.cm-content) :is(p, h1, h2, h3, h4, h5, h6):not(td *, th *) { position: relative; }