Redesign the character palettes from the reference cards

Phase 5a-4. The owner chose candidate B of each palette.

- Harvest Moon uses copper from Holo's tail as the accent, cream from
  the tail tip, and red-brown surfaces.
- Crimson Pilot uses plugsuit red as the accent, orange hair, blue eyes,
  and the yellow dress. Borders are a low-chroma wine. Error is a light
  rose red, so it differs from the accent.
- Silver Serpent uses silver from the grey eyes as the accent, Slytherin
  emerald as the second accent, and charcoal surfaces.
- All eight built-in palettes pass every readability rule. The
  known-failure list in contrast.spec.ts is gone.
- characterPalettes.spec.ts measures text selection as the app draws
  it, at most 65% opaque over the page (UI-029).
- Docs: UI-045, and the character references in ui-color.md.

pnpm check passes. pnpm test: 446 of 446 pass. Full smoke suite: 95
passed, 2 known.
This commit is contained in:
Knotty Wyvern
2026-10-28 17:25:51 -07:00
parent a34c1a5dce
commit 35f39e93f3
10 changed files with 63 additions and 47 deletions
+1 -19
View File
@@ -9,13 +9,6 @@ import { BASE_ROLES, resolveColors, type Mode } from '../../../src/lib/theme/rol
import { RULES, checkTheme } from '../../../src/lib/theme/contrast.ts';
import { composite, contrast, distance, formatHex, mix, parseHex } from '../../../src/lib/theme/color.ts';
// Rules that a palette fails today. Stage 5a-4 redesigns these palettes and removes each entry.
const KNOWN_FAILURES: Record<string, readonly string[]> = {
'harvest-moon/dark': ['status-text', 'status-distinct'],
'crimson-pilot/dark': ['status-distinct'],
'silver-serpent/dark': ['status-text', 'status-distinct'],
};
const variants = BUILTIN_THEMES.flatMap(theme => Object.entries(theme.variants).map(([mode, colors]) => ({ key: `${theme.id}/${mode}`, mode: mode as Mode, colors: colors! })));
for (const variant of variants) {
@@ -23,24 +16,13 @@ for (const variant of variants) {
for (const rule of RULES) {
const results = findings.filter(finding => finding.rule === rule.id);
if (!results.length) continue;
const known = KNOWN_FAILURES[variant.key]?.includes(rule.id);
const failures = results.filter(finding => !finding.pass).map(finding => `${finding.subject}: ${finding.value.toFixed(2)} (minimum ${finding.min})`);
test(`${variant.key} passes the ${rule.id} rule`, known ? { todo: 'Known palette failure. Stage 5a-4 redesigns this palette.' } : {}, () => {
test(`${variant.key} passes the ${rule.id} rule`, () => {
assert.deepEqual(failures, []);
});
if (known) test(`${variant.key} still fails the known ${rule.id} rule`, () => {
assert(failures.length > 0, `Remove ${rule.id} from KNOWN_FAILURES['${variant.key}'].`);
});
}
}
test('Each known failure names a built-in variant and a rule', () => {
for (const [key, rules] of Object.entries(KNOWN_FAILURES)) {
assert(variants.some(variant => variant.key === key), key);
for (const rule of rules) assert(RULES.some(item => item.id === rule), `${key}: ${rule}`);
}
});
test('Every built-in variant gives all base roles as hex colors', () => {
for (const variant of variants) {
for (const role of BASE_ROLES) assert.match(variant.colors[role] ?? '', /^#[0-9a-f]{6}$/, `${variant.key}: ${role}`);