Source draws search matches and selection matches with the item selection fill, behind code. No rule checked that surface. In four core palettes, code colors were 3.8:1 to 4.3:1 on it, and dim text in a selected row was 4.0:1 in two light palettes. - The text rule also checks the item selection fill over bg-elevated. The syntax rule also checks the fill over bg (UI-046). - The derived fill is the accent at 12%, not 20%. RuneStone, Claude, and custom themes without their own fill use it. Sakura and the character themes set their own fill and pass. - Matches keep their underline, and selected rows keep their outline. pnpm check passes. pnpm test: 446 of 446 pass. Full smoke suite: 92 passed, 2 known. Three tests failed one time while Vite compiled the changed modules, and passed on retry and 3 of 3 times alone.
8.4 KiB
Functional color
Interface design · Design decisions
This guide sets the color rules for RuneStone and its plugins, for human developers and agents.
Agents also apply the user-level ui-functional-color skill. This guide adds the project roles, references, thresholds, and evidence.
Default
- Start accents, priority, status, selection outlines, syntax, and important data with vivid, distinct candidates. Full saturation and full HSV value are normal options.
- Pick the stronger candidate when readability, meaning, and distinction stay correct.
- Do not soften a color only to look quiet, refined, professional, premium, minimal, or cohesive. A softer choice needs a concrete reason and before-and-after evidence.
- A quiet layout comes from spacing, hierarchy, and the amount of color on screen. It does not need a faded palette.
- Existing muted values are not an approved soft design.
- Keep informative text and symbols opaque.
Roles and tokens
A theme is data. Each built-in theme is one file in src/lib/theme/themes/, with one palette for each mode that it offers.
src/lib/theme/roles.ts lists the color roles. Each role is the CSS token --rs-<role>.
A theme gives the base roles. One rule for all themes fills each other role from the base roles, unless the theme gives a value.
No code outside the theme data names a theme ID. tests/unit/theme/contrast.spec.ts checks this.
Correct a wrong color in the theme data or in the derivation rule. Do not add local saturation or opacity overrides.
| Role | Tokens | Requirement |
|---|---|---|
| Theme identity | --rs-accent, --rs-accent-2 |
Keep the characteristic hues of the reference at their strength. |
| Status | --rs-error, --rs-warn, --rs-warn-hot, --rs-ok |
Use clear, assertive colors. Pair color with a shape or text. |
| Priority (Project Management) | --pm-priority-color in the plugin src/style.css |
Full saturation and value, with opaque symbols and readable text. |
| Links and actions | --rs-link (from --rs-accent unless the theme sets it) |
Keep actionable text distinct and readable on its actual surface. |
| Text on an accent fill | --rs-on-accent (black or white, whichever is more readable) |
Readable text and icons on accent buttons and badges. |
| Focus | --rs-focus (from --rs-accent unless the theme sets it) |
A visible outline on every surface. |
| Selection | --rs-item-selection-*, --rs-selection, --rs-selection-text |
Show a clear state change and boundary. Content inside the selection stays readable. |
| Highlighted text | --rs-highlight |
A fill that keeps the text readable. |
| Syntax | --rs-syntax-*, one for each role in SYNTAX_ROLES |
Give each meaning a distinct color. A palette has at least 7 distinct syntax colors. |
| Terminal | --rs-ansi-* and --rs-ansi-bright-*, one for each color in ANSI_COLORS |
Each color keeps its ANSI hue in every theme. Blue stays blue, also in a red theme. |
| Surfaces and dividers | --rs-bg, --rs-bg-elevated, --rs-bg-active, --rs-border, --rs-line-highlight, --rs-scrim, --rs-image-* tints |
Support the content. Choose their strength by function. |
| Disabled states | Role tokens of the control | Keep labels readable. Do not apply disabled opacity to enabled content. |
Do not fade a whole badge, row, or container when only its background needs transparency. Plugins use the same tokens. Theme tokens lists them for plugin authors.
Theme references
- Read the current reference cards, and obey the source priority that the user gives.
- RuneStone takes its accent from the rune glow of the app icon (
src-tauri/icons/icon.png). Claude takes its colors from the Anthropic brand guide. Sakura takes its colors from the palette image in its data file. - A text role keeps the hue of its reference color. Change only its lightness until it reaches the readability minimum, and call the result an adaptation.
- Harvest Moon (Holo) uses the current fan art. Removed images do not count for later palette decisions.
- Crimson Pilot (Asuka) and Silver Serpent (Malfoid) use their reference cards. For Malfoid, the books win over fan art, so the eyes are grey.
- A character color goes to the accents, the selection, and the syntax roles. Surfaces and borders get low-chroma tints of the character, so status colors stay visible.
- Take the colors of the character. Exclude scenery, lighting, alternate clothing, and unrelated details.
- The trading screenshot and the Bloomberg example show clear information and state distinctions. They do not ask for a terminal-like appearance.
Known failures
The October 13 review found these problems. The values record that correction. They are not quotas for future themes.
| Palette | Problem | Correction |
|---|---|---|
| Harvest Moon (Holo) | Marsh green and pink roles did not match the identity. | Warm copper, chestnut, amber, and red |
| Crimson Pilot (Asuka) | Repeated green and similar cyan roles | Red, orange, yellow, and blue carry distinct meanings. |
| Silver Serpent (Malfoid) | Sage accent and near-gray syntax | Emerald accent, saturation from about 29% to 76% |
| Priority marks | Too dark to draw attention | Full saturation and value, with readable text |
The October 13 menu and color review holds the measurements and the image-surface limits.
Readability rules
src/lib/theme/contrast.ts holds these rules. tests/unit/theme/contrast.spec.ts applies them to every built-in palette. The theme editor can show the same results.
Each surface is the color that the app draws: a translucent role is composited onto bg. Text selection is at most 65% opaque.
| Rule | Check | Minimum |
|---|---|---|
text |
text, text-dim, and text-strong on bg, bg-elevated, bg-active, selection, and the item selection fill over bg-elevated |
4.5:1 |
accent-text |
accent, accent-2, and link on bg, bg-elevated, and bg-active |
4.5:1 |
status-text |
error, warn, and ok on bg and bg-elevated |
4.5:1 |
syntax |
Each syntax role on bg, bg-active, line-highlight, and the item selection fill over bg (search and selection matches in Source) |
4.5:1 |
ansi |
Red, green, yellow, blue, magenta, and cyan terminal colors, and their bright variants, on bg |
4.5:1 |
focus |
focus on bg, bg-elevated, and bg-active |
3:1 |
on-accent |
on-accent on accent |
4.5:1 |
highlight |
text on highlighted text |
4.5:1 |
selection-outline |
accent on the item selection fill over bg-elevated |
3:1 |
status-distinct |
OKLab distance between accent, error, warn, and ok, in pairs |
0.1 |
syntax-variety |
Distinct syntax colors | 7 |
light-page |
In a light palette, bg is lighter than bg-elevated and bg-active |
— |
accent on selection is exempt from the 4.5:1 text check. Run the tests with pnpm test.
Every built-in palette passes every rule. A palette that fails a rule fails the test.
tests/unit/theme/characterPalettes.spec.ts adds the checks of each character palette, for example over image tints. It measures text selection as the app draws it: at most 65% opaque over the page.
Over a user image, contrast depends on the composite surface. Measure the 82% and 90% tints over the image that the change uses. Do not claim contrast over every possible image or overlay.
When contrast fails, change the foreground, background, surface, or role before you reduce color strength.
Evidence for review
Record the evidence that the ui-functional-color skill lists for each changed role. For RuneStone, also record:
- The shared token and the affected controls.
- Each named palette and appearance that uses the token.
- Contrast on the actual composite surface, including image tints, overlays, and selected states.
- Screenshots at normal scale of the content, code, menus, and priority marks where the token appears.
- For a softer choice, the stronger candidate and the requirement or measured problem that rejected it.
- Checks that you could not run. Browser mocks do not replace native desktop checks.
Correct unexplained muting, or record it as unresolved, before the work moves to Review. A deliberate departure needs an exception entry in the design decision log. The entry alone does not authorize it.
Decision: UI-024.