Palette: add per-color foregrounds with a WCAG AA contrast guard #5

Merged
raisondetredev merged 1 commit from refs/pull/5/head into main 2026-07-08 22:40:48 +02:00
raisondetredev commented 2026-07-08 22:40:35 +02:00 (Migrated from codeberg.org)

Each picker color now ships a (background, foreground, outline) triple.
The foreground is the text/icon color to use on the background fill:
pure white or pure black per color, whichever contrasts more. No single
theme-wide text color is readable across all 20 fills (in light mode
every fill fails 4.5:1 against Material's default label colors; in dark
mode 8 do in the other direction) — a per-color pick passes AA on all
20, worst case sahara at 4.59:1.

Guarded by tests: every pair must meet 4.5:1, and foregrounds must stay
pure white/black unless deliberately hand-tuned. The enum-sync test's
exhaustive switch is hoisted into a shared helper covering the triple.

Each picker color now ships a (background, foreground, outline) triple. The foreground is the text/icon color to use on the background fill: pure white or pure black per color, whichever contrasts more. No single theme-wide text color is readable across all 20 fills (in light mode every fill fails 4.5:1 against Material's default label colors; in dark mode 8 do in the other direction) — a per-color pick passes AA on all 20, worst case sahara at 4.59:1. Guarded by tests: every pair must meet 4.5:1, and foregrounds must stay pure white/black unless deliberately hand-tuned. The enum-sync test's exhaustive switch is hoisted into a shared helper covering the triple.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
project-halkyon/halkyon-shared!5
No description provided.