Add the theme editor tab and theme preview cards

Phase 5a-5.

- Settings → Appearance shows a preview card for each theme. The cards
  are one radio group. The arrow keys move and select, and the current
  card has the selection outline and a check mark (UI-047).
- Edit theme opens the theme editor as a workbench tab in the window
  that opened Settings. The window shows each change at once.
- The editor shows all 51 color roles in seven groups. Each role has a
  color picker, a hex field, its lowest readability result, and a reset
  button. A failure shows a warning icon and its ratio, or "Too close".
- Save writes a short schema 3 theme with the built-in theme as its
  base. A built-in theme does not change. Discard returns to the saved
  colors, and Duplicate saves a copy.
- The editor is a built-in package, like the browser, so it uses the
  editor tab code of plugins.
- 23 new catalog rows with French, Japanese, and Simplified Chinese.
- The smoke harness sends emit to every page and emit_to to the pages
  with the target window label.
- Docs: UI-047, ui-design.md, and "Edit a theme" in guides/themes.md.

New tests: appearance/themeEditor and tests/unit/theme/themeEditor.spec.ts.
Six smoke tests use the cards instead of the theme menu.
This commit is contained in:
Knotty Wyvern
2026-10-28 18:13:57 -07:00
parent d160568249
commit 5483881bc2
26 changed files with 722 additions and 97 deletions
+17
View File
@@ -886,3 +886,20 @@ Native shell, background image, and desktop acceptance remain open.
- Evidence: `tests/unit/theme/contrast.spec.ts` applies the new checks to every built-in palette. Screenshots are in `output/phase-5a/5a-4/match-fill/` in the main checkout.
- Replaces / replaced by: None.
- Limits: Browser checks use desktop service mocks. Native desktop acceptance remains open.
### UI-047 — Theme editor tab and theme cards
- Type: Rule change
- Date: 2026-10-28
- Status: Implemented for user review
- Decision source: The approved Phase 5a plan of 2026-10-28, stage 5a-5: the editor is a workbench tab, and the picker shows preview cards with a check mark.
- Previous rule: Appearance chose the theme from a text menu. A custom theme came only from an edited JSON file.
- New rule: Appearance shows a preview card for each theme. The cards are one radio group: the arrow keys move and select, and the current card has the selection outline and a check mark. **Edit theme** opens the theme editor as a workbench tab in the window that opened Settings.
- Editor: Seven groups show every color role. Each role has a color picker, a hex field, the lowest result of the readability rules that it takes part in, and a reset button after a change. A warning icon and the text of the result mark a failure, not color alone. The window shows each change at once. Save writes a short schema 3 theme with the built-in theme as its base. A built-in theme does not change: Save creates a custom theme. Discard returns to the saved colors. Duplicate saves a copy. Closing the tab without a save returns the window to the saved theme.
- Implementation: The editor is a built-in package, like the browser. Its view uses the editor tab code of plugins. The Settings window sends `runestone-theme-editor-open` to the window that opened it. The in-window Settings dialog closes when the editor opens.
- Reason: The real window is the preview. The cards show each theme before a choice.
- Scope: Settings → Appearance and the theme editor tab.
- Shared implementation: `ThemePicker.svelte`, `ThemeEditor.svelte`, `themeEditor.ts`, `editorView.ts`, `themeEditorRequest.ts`, `appearance.ts` (`applyThemeColors`), and the built-in activation in `plugins/external.ts`.
- Evidence: `tests/smoke/appearance/themeEditor.smoke.mjs` and `tests/unit/theme/themeEditor.spec.ts`. Screenshots are in `output/phase-5a/5a-5/` in the main checkout.
- Replaces / replaced by: The theme choice in the action menu rule of "Choice lists and pickers". Other short choices stay in the action menu.
- Limits: The editor changes colors, not fonts. Browser checks use desktop service mocks. Native desktop acceptance remains open.
+20 -3
View File
@@ -2,7 +2,7 @@
[RuneStone](../../README.md) · [User guide](../user-guide.md)
This guide explains how to choose colors, set a background image, and create or share a custom theme.
This guide explains how to choose colors, set a background image, and edit, create, or share a custom theme.
Open **Settings → Appearance**. Appearance settings apply to all workspaces on this computer and to all open windows.
@@ -15,11 +15,14 @@ Open **Settings → Appearance**. Appearance settings apply to all workspaces on
| Sakura | Light only |
| Harvest Moon, Crimson Pilot, Silver Serpent | Dark only |
Select a theme card to use that theme. A check mark shows the current theme. In the cards, the arrow keys move to the next theme and select it.
Each named theme has its own fonts and syntax colors. Fonts come from your computer. RuneStone does not download fonts.
## Adjust transparency
**Transparent surfaces** tints menus, work areas with a background image, and compatible plugin surfaces.
**Transparent surfaces** tints work areas with a background image and compatible plugin surfaces.
Menus stay opaque. With a background image, menus are at least 92% opaque and blur the image.
Set **Transparency amount** from 0% to 100%. The default is 18%.
Turn off **Transparent surfaces** for opaque surfaces. Text and icons stay opaque in both cases.
@@ -33,7 +36,21 @@ Turn off **Transparent surfaces** for opaque surfaces. Text and icons stay opaqu
The image shows in new tabs. RuneStone keeps it on this computer.
The Project Management plugin can keep a separate image for a board. The Background Slideshow plugin can replace the image for a time.
## Create a theme
## Edit a theme
1. Select the theme that you want to start from.
2. Choose **Edit theme**. The theme editor opens as a tab in the workspace window.
3. Change a color with its swatch or its hex value. The window shows each change at once.
4. Choose **Save**.
A built-in theme does not change. **Save** creates a custom theme from it, with only the colors that you changed. The built-in theme stays its base.
- Each color shows its lowest contrast result. A warning icon marks a color that fails a [readability rule](../ui-color.md#readability-rules). Point to the result to see the failed checks.
- The reset button returns a color to the value of the base theme.
- **Discard** returns to the saved colors. **Duplicate** saves a copy and selects it.
- If you close the tab without **Save**, the window returns to the saved theme.
## Create a theme file
1. Select the theme and appearance that you want to start from.
2. Choose **Export theme template**.
+4 -4
View File
@@ -147,11 +147,11 @@
},
"RuneStone/src/lib/theme/AppearanceSettings.svelte": {
"counts": {
"action": 2,
"localPopup": 3
"action": 1,
"localPopup": 2
},
"design": "Shared action menu",
"check": "tests/smoke/appearance/characterThemes.smoke.mjs"
"design": "Shared action menu for image position and size. Theme choice uses preview cards (UI-047).",
"check": "tests/smoke/appearance/backgroundImages.smoke.mjs"
},
"RuneStone/src/lib/ui/actionMenu.ts": {
"counts": {
+5 -2
View File
@@ -120,7 +120,8 @@ Use one menu design for context menus, action menus, and their submenus in the h
### Choice lists and pickers
- Use the shared action menu for short option lists, such as board, list, theme, appearance, and language choices.
- Use the shared action menu for short option lists, such as board, list, appearance, and language choices.
- Visual choices, such as themes, use preview cards. The cards are one radio group, and a check mark marks the current choice.
- Use a searchable picker for long lists.
- Replace native selects with the shared action menu wherever the host API exists. Native selects stay only as documented fallbacks for older plugin hosts.
- Rich pickers and dialogs can have their own layout when they contain search fields, descriptions, or forms. These layouts do not need an exception entry.
@@ -156,9 +157,11 @@ 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.
- Appearance shows a preview card for each theme. The arrow keys move between the cards and select a theme. The current card has the selection outline and a check mark.
- **Edit theme** opens the theme editor as a workbench tab in the window that opened Settings. The editor shows every color role in groups, with a swatch, a hex field, the lowest contrast result, and a reset button. Each change shows at once in that window. Save writes a short schema 3 theme with a base.
- 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), [UI-042](design-decisions.md#ui-042--theme-file-format-3-and-terminal-colors).
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), [UI-047](design-decisions.md#ui-047--theme-editor-tab-and-theme-cards).
## Typography and tables