Check text and code on the selection fill
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.
This commit is contained in:
@@ -870,3 +870,19 @@ Native shell, background image, and desktop acceptance remain open.
|
||||
- Evidence: The comparison sheets and `readability.md` in `output/phase-5a/5a-4/` in the main checkout.
|
||||
- Replaces / replaced by: The palette values of [UI-012](#ui-012--retain-three-stronger-character-themes). Its theme set and names remain.
|
||||
- Limits: Browser checks use desktop service mocks. Native desktop acceptance remains open. The KnottyWyvern Portal still uses the earlier Harvest Moon colors.
|
||||
|
||||
### UI-046 — Readable matches and selected rows
|
||||
|
||||
- Type: Rule change
|
||||
- Date: 2026-10-28
|
||||
- Status: Implemented for user review
|
||||
- Decision source: A gap found in stage 5a-4. The owner approved the fix on 2026-10-28.
|
||||
- Previous rule: `--rs-item-selection-bg` came from the accent at 20%. Source draws search matches and selection matches with this fill behind code, and no rule checked that surface. In four core palettes, syntax colors were 3.8:1 to 4.3:1 on it. In RuneStone Light and Claude Light, dim text was 4.0:1 to 4.2:1 on the file selection fill.
|
||||
- New rule: The `text` rule also checks the item selection fill over `bg-elevated`. The `syntax` rule also checks the item selection fill over `bg`. The derived fill is the accent at 12%.
|
||||
- Reason: Code inside a search match and dim text in a selected row stay readable. The selection outline keeps the boundary visible.
|
||||
- Scope: Every theme that does not set its own `item-selection-bg`: RuneStone, Claude, and custom themes. Sakura and the character themes set their own fill and pass.
|
||||
- Shared implementation: `roles.ts` (the derivation), `contrast.ts` (the `match` surface), and the root default in `tokens.css`.
|
||||
- Visible changes: Selected rows, table cells, Settings navigation, and Source matches have a lighter fill in RuneStone and Claude.
|
||||
- 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.
|
||||
|
||||
+2
-2
@@ -72,10 +72,10 @@ Each surface is the color that the app draws: a translucent role is composited o
|
||||
|
||||
| Rule | Check | Minimum |
|
||||
| --- | --- | --- |
|
||||
| `text` | `text`, `text-dim`, and `text-strong` on `bg`, `bg-elevated`, `bg-active`, and `selection` | 4.5:1 |
|
||||
| `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`, and `line-highlight` | 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 |
|
||||
|
||||
@@ -21,6 +21,8 @@ export const SURFACES = {
|
||||
'line-highlight': colors => composite(colors['line-highlight'], opaque(colors.bg)),
|
||||
highlight: colors => composite(mix(colors.highlight, '#0000', 0.3), opaque(colors.bg)),
|
||||
'item-selection': colors => composite(colors['item-selection-bg'], composite(colors['bg-elevated'], opaque(colors.bg))),
|
||||
// Source draws search matches and selection matches with the item selection fill, behind code.
|
||||
match: colors => composite(colors['item-selection-bg'], opaque(colors.bg)),
|
||||
accent: colors => composite(colors.accent, opaque(colors.bg)),
|
||||
} satisfies Record<string, (colors: ResolvedColors) => string>;
|
||||
export type Surface = keyof typeof SURFACES;
|
||||
@@ -41,10 +43,10 @@ export type Rule = ContrastRule | DistinctRule | VarietyRule | LightestRule;
|
||||
export const DISTINCT_DISTANCE = 0.1;
|
||||
|
||||
export const RULES: readonly Rule[] = [
|
||||
{ id: 'text', kind: 'contrast', foregrounds: ['text', 'text-dim', 'text-strong'], surfaces: ['bg', 'bg-elevated', 'bg-active', 'selection'], min: 4.5 },
|
||||
{ id: 'text', kind: 'contrast', foregrounds: ['text', 'text-dim', 'text-strong'], surfaces: ['bg', 'bg-elevated', 'bg-active', 'selection', 'item-selection'], min: 4.5 },
|
||||
{ id: 'accent-text', kind: 'contrast', foregrounds: ['accent', 'accent-2', 'link'], surfaces: ['bg', 'bg-elevated', 'bg-active'], min: 4.5 },
|
||||
{ id: 'status-text', kind: 'contrast', foregrounds: ['error', 'warn', 'ok'], surfaces: ['bg', 'bg-elevated'], min: 4.5 },
|
||||
{ id: 'syntax', kind: 'contrast', foregrounds: SYNTAX, surfaces: ['bg', 'bg-active', 'line-highlight'], min: 4.5 },
|
||||
{ id: 'syntax', kind: 'contrast', foregrounds: SYNTAX, surfaces: ['bg', 'bg-active', 'line-highlight', 'match'], min: 4.5 },
|
||||
{ id: 'ansi', kind: 'contrast', foregrounds: ANSI, surfaces: ['bg'], min: 4.5 },
|
||||
{ id: 'focus', kind: 'contrast', foregrounds: ['focus'], surfaces: ['bg', 'bg-elevated', 'bg-active'], min: 3 },
|
||||
{ id: 'on-accent', kind: 'contrast', foregrounds: ['on-accent'], surfaces: ['accent'], min: 4.5 },
|
||||
|
||||
@@ -41,7 +41,7 @@ const DERIVED: Record<Exclude<Role, typeof BASE_ROLES[number]>, Derive> = {
|
||||
link: colors => colors.accent,
|
||||
focus: colors => colors.accent,
|
||||
'on-accent': colors => readableOn(colors.accent),
|
||||
'item-selection-bg': colors => mix(colors.accent, '#0000', 0.2),
|
||||
'item-selection-bg': colors => mix(colors.accent, '#0000', 0.12),
|
||||
'line-highlight': (_, mode) => mode === 'light' ? '#0000000d' : '#ffffff0d',
|
||||
highlight: () => '#edc65b',
|
||||
scrim: () => '#00000088',
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
--rs-image-menu-backdrop: blur(18px) saturate(1.2);
|
||||
--rs-menu-shadow: 0 8px 30px #0006;
|
||||
--rs-item-selection-radius: var(--rs-control-radius);
|
||||
--rs-item-selection-bg: color-mix(in srgb, var(--rs-accent) 20%, transparent);
|
||||
--rs-item-selection-bg: color-mix(in srgb, var(--rs-accent) 12%, transparent);
|
||||
--rs-item-selection-border: var(--rs-accent);
|
||||
--rs-item-selection-width: 2px;
|
||||
--rs-bg: #151617;
|
||||
|
||||
Reference in New Issue
Block a user