Unit tests go to tests/unit/<area>/, browser smoke tests to tests/smoke/<area>/, and tests against a running desktop app to tests/native/. Files named after dates, work passes, or Kanban cards get feature names, for example editorOctober12 -> editor/footnotes. scripts/ keeps the build, release, and package tools. Plugin repositories import scripts/packagePlugin.mjs, and the Terminal smoke test imports scripts/pluginMocks.mjs, which now re-exports the harness copy. The unit tests get their own type check (tests/tsconfig.json) with Node types. pnpm check runs it after the app check. Add @types/node and fix the three test mocks that it reported.
81 lines
5.4 KiB
Markdown
81 lines
5.4 KiB
Markdown
# Functional color
|
|
|
|
[Interface design](ui-design.md) · [Design decisions](design-decisions.md)
|
|
|
|
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
|
|
|
|
All tokens are in `src/lib/theme/tokens.css`, unless the table names another file. Correct a wrong token at its source. Do not add local saturation or opacity overrides.
|
|
|
|
| Role | Tokens | Requirement |
|
|
| --- | --- | --- |
|
|
| Theme identity | `--rs-accent`, `--rs-accent-2`, palette surfaces in `src/lib/theme/characterThemes.ts` | 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-accent` | Keep actionable text distinct and readable on its actual surface. |
|
|
| Selection and focus | `--rs-item-selection-*`, `--rs-selection`, `--rs-selection-text` | Show a clear state change and boundary. Content inside the selection stays 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. |
|
|
| Surfaces and dividers | `--rs-bg`, `--rs-bg-elevated`, `--rs-bg-active`, `--rs-border`, `--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.
|
|
|
|
## Theme references
|
|
|
|
- Read the current reference cards, and obey the source priority that the user gives.
|
|
- Harvest Moon (Holo) uses the current fan art. Removed images do not count for later palette decisions.
|
|
- 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](archive/menu-audit-2026-10-13.md) holds the measurements and the image-surface limits.
|
|
|
|
## Contrast thresholds
|
|
|
|
| Pair | Minimum | Test |
|
|
| --- | --- | --- |
|
|
| `text`, `text-dim`, `text-strong`, and `accent` on `bg`, `bg-elevated`, `bg-active`, and `selection` | 4.5:1 | `tests/unit/theme/appearance.spec.ts`, `tests/unit/theme/themePalette.spec.ts` |
|
|
| Each syntax role on `bg` and `bg-active` | 4.5:1 | `tests/unit/theme/appearance.spec.ts` |
|
|
| Accent selection perimeter on the selection fill | 3:1 | `tests/unit/theme/malfoidPalette.spec.ts` |
|
|
|
|
`accent` on `selection` is exempt from the 4.5:1 text check. Run the tests with `pnpm test`.
|
|
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](design-decisions.md). The entry alone does not authorize it.
|
|
|
|
Decision: [UI-024](design-decisions.md#ui-024--assertive-functional-color-by-default).
|