How to generate an accessible color palette from a single color taisho.design · ...
HN Best 200 @best
How to generate an accessible color palette from a single color taisho.design · 11 points · 0 comments · HN thread
TL;DR Pablo Di Filippo describes how TaishoDS Core, a new MIT-licensed HTML/CSS/JS design system, generates a ten-step color scale from one brand color: it fixes a target WCAG contrast ratio for each step first, then solves for the OKLCH lightness that meets it. He reports that across 4,096 starting colors and 81,920 steps, text contrast never fell below 4.63 (AA requires 4.5), and he documents the failure modes and a planned 0.17 change. The thread has no comments yet.
- The first engine used evenly spaced OKLCH lightness values; in a test of 648 colors, 45 produced at least one step failing AA, with a worst pair at 4.10.
- The current method sets target contrast ratios per step (1.08 to 19 on white), places the starting color on the step where its own ratio belongs, and solves lightness for the other nine steps.
- Against Tailwind 4's 500 steps, the green and yellow contrasts differ sharply (2.25 vs 3.60 and 1.93 vs 3.60), while blue and red match closely.
- About 1 in 10 scales (803 of 8,192) had the brand color shifted because it fell in a band where neither light nor dark text reached AA; the author admits a correction could push some colors below 4.5 against the background.
- Version 0.17 will measure both text contrast and background contrast in 8-bit values, lower the lowest computed text contrast to 4.50, and add a seedFit option to keep the brand color exact.
Discussion The thread has no comments yet, so there is no community discussion to summarize. The story has 11 points and has not drawn any responses at the time of this digest.
#accessibility #colorPalette #designSystems #wcag #oklch #css