Generating Accessible Color Palettes from a Single Color: Principles and Practical Guide

Derive an accessible palette by rules from a single brand color in a perceptually uniform color space.
The article explores how to systematically generate an accessible palette from a single brand color. The core idea is to converge the starting point of color selection to one color for brand consistency, then derive the remaining shades through contrast validation and perceptual uniformity rules. The specific path includes: stepping lightness in perceptually uniform color spaces like OKLCH and LCH to avoid visual unevenness from RGB/HSL adjustments; using WCAG contrast thresholds to assign shade usage (body text, large headings, icons, backgrounds); introducing lightness differences or redundant coding for status colors to cover color vision deficiency; and solidifying validation as a default step through scripts. The article also points out common misconceptions, such as equating contrast compliance with the entirety of accessibility, over-pursuing shade quantity, and the need to generate lightness-shifted versions for brand primary colors under light and dark themes separately.
Why Start from a Single Color for Accessible Color Schemes
Designers and developers often start from a single brand primary color or interface accent color, but quickly encounter the same problem: this color doesn't have enough contrast on dark backgrounds, is too harsh on light backgrounds, and that's before even considering whether colorblind users can distinguish status colors. A post discussing "how to generate an accessible palette from a single color" recently appeared on Hacker News. Although it didn't get much attention (5 points, no comments), it points to a very practical need: converging the starting point of color selection to a single color, then systematically deriving a complete usable color system.
The logic behind this approach is: a single color naturally guarantees brand consistency, while the rest of the palette is generated by contrast and perceptual uniformity rules, thereby satisfying accessibility requirements while preserving visual identity.

Understanding the Two Hard Constraints of "Accessible Color"
Accessible color schemes aren't about slapping a "compliant" label on every color, but rather satisfying two dimensions simultaneously.
Contrast: WCAG's Readability Baseline
The contrast ratio between text and background is the most commonly tested metric. A common requirement is that body text reaches a higher contrast threshold, while large text can be relaxed. When generating a palette from a single color, the key action is calculating the contrast of that color at different lightness levels against foreground colors (usually black or white text), then deciding which shades can carry body text and which can only be used for decoration or large background areas.
A practical approach is: treat the primary color as the hue anchor, generate a series of shades around it on the lightness axis, then calculate contrast for each one, excluding non-compliant shades from text scenarios. What you get isn't "a bunch of pretty colors" but a shade table with usage annotations.
WCAG (Web Content Accessibility Guidelines) is a web accessibility guideline published by the W3C. Its contrast standard (1.4.3) requires body text to have a contrast ratio of at least 4.5:1 against the background, and large text (18pt or 14pt bold and above) at least 3:1. The contrast ratio formula is based on relative luminance: first apply gamma correction to each channel (linearization under sRGB), then perform a weighted sum using 0.2126R + 0.7152G + 0.0722B, and finally compute the ratio using (L1+0.05)/(L2+0.05), where L1 is the luminance of the lighter color. Understanding this formula helps predict whether a shade can be used for body text—it doesn't change linearly; the closer the lightness is to black or white, the more dramatic the contrast changes become.
Color Vision Deficiency: Can't Rely on Hue Alone
Meeting contrast requirements doesn't mean colorblind users can tell colors apart. Red-green color vision deficiency is the most common type. If status colors (success, warning, error) are distinguished only by hue, some users will see nearly identical colors. When generating a palette, you need to additionally introduce lightness differences, patterns, or text labels as redundant coding.
The advantage of starting from a single color is that you can deliberately control the lightness spacing between derived colors, rather than relying on two random hues happening to be sufficiently different.
The most common type of color vision deficiency (CVD) is red-green colorblindness, affecting about 8% of men and 0.5% of women. Red-green colorblindness is further divided into protanopia and deuteranopia, both of which cause red, green, orange, and similar hues to converge perceptually, though lightness information is usually preserved. There are also rarer types such as tritanopia (blue-yellow colorblindness) and achromatopsia (total colorblindness). When designing, you can use simulation tools (such as Chrome DevTools' Rendering panel or the Stark plugin) to preview colorblind perspectives, and follow the principle of "not relying on a single hue": status colors should also have lightness differences, supplemented by icons, text labels, or textures as redundant coding to ensure information isn't lost.
The Generation Path from Single Color to Palette
Step 1: Put the Color into a Perceptually Uniform Color Space
Directly adjusting lightness in RGB or HSL easily leads to the problem of "mathematically equidistant but visually uneven brightness." A more reliable approach is to convert the base color into a perceptually uniform color space (such as OKLCH, LCH, and similar), and derive at equal steps in lightness and chroma. The shades generated this way are visually smoother, and subsequent contrast calculations are more predictable.
In practice: keep the hue unchanged, fix a set of lightness levels, then adjust chroma for each level to avoid colors becoming grayish at the low-lightness end and overly saturated at the high-lightness end. This process can be scripted—generate once, reuse many times.
A perceptually uniform color space is a color model in which human perception of color differences is roughly proportional to numerical distances in the space. Traditional RGB and HSL are not perceptually uniform: in HSL, adjusting lightness from 50% to 60% versus from 80% to 90% produces different magnitudes of visual change. CIELAB (and its polar form LCH) is an earlier perceptually uniform space, while OKLCH is a more recent improved version proposed by Björn Ottosson, based on OKLab, with better performance in lightness prediction and hue linearity, and simpler computation. OKLCH describes colors using three components: L (perceptual lightness, 0–1), C (chroma, 0 to about 0.4), and H (hue angle). CSS Color 4 natively supports the oklch() function, making it a practical choice for modern design token generation.
Step 2: Use Contrast Validation to Filter Shade Usage
After generating the shades, calculate contrast against both black and white text for each one. Shades above the body text threshold are marked as "usable for body text," shades in the middle range are marked as "usable for large headings or icons," and those below the threshold can only serve as backgrounds or decoration. This step transforms "pretty" into "usable" and is the watershed between accessible palettes and ordinary color swatches.
Step 3: Fill in Semantic Colors and Neutral Colors
A single brand color can't cover all interface semantics. Status colors such as success, warning, and error need to be generated independently, but directly introducing standard red, green, and yellow often breaks overall harmony. A more common approach is to adjust hue offset and chroma based on the primary color, so that status colors remain recognizable while maintaining a family feel with the primary color system. Neutral colors (grayscale) can also be extracted from the primary color as extremely low-chroma versions, giving the grays in the interface a slight tint of the primary color for a more unified whole.
Tools and Automation: Turning Rules into a Pipeline
There are currently two common implementation approaches. One is palette plugins in design tools that automatically generate shades and annotate contrast after inputting a base color; the other is color generation libraries on the code side that encapsulate color space conversion, lightness stepping, and contrast calculation into functions, making it easy to directly produce CSS variables or design tokens in the build process.
The real value of automation isn't saving manual color adjustment, but making "accessibility validation" a default step. When color schemes are generated by scripts, any newly added shade automatically undergoes contrast checking, avoiding problems missed by manual spot-checking later.
Common Misconceptions and Trade-offs
The first misconception is treating contrast compliance as the entirety of accessibility. Contrast only solves "can see clearly," not "can distinguish clearly"—status colors still need redundant coding. The second misconception is over-pursuing the number of shades, generating a dozen levels without being able to articulate the purpose of each, which actually increases maintenance costs. A more pragmatic approach is to trim by usage, keeping only the necessary levels for body text, secondary text, borders, backgrounds, etc.
There's another easily overlooked trade-off: the brand primary color itself may not be able to simultaneously meet contrast requirements under both light and dark themes. In this case, you shouldn't force the same shade to serve both roles, but instead generate lightness-shifted versions separately for each theme, keeping hue consistent while varying lightness.
Summary
Generating an accessible palette from a single color is essentially transforming color selection from "picking by feel" to "deriving by rules." The core steps can be summarized as: generate shades in a perceptually uniform color space, use contrast validation to assign usage, use lightness differences and redundant coding to cover color vision deficiency, and finally solidify validation into the process through scripts. For teams that need to maintain design systems long-term, the benefits of this approach grow as the number of shades increases.
Related articles

When Visual Records Are No Longer Trustworthy: Rebuilding Trust in the Age of AI
Can we still trust our eyes as AI-generated images and videos become increasingly realistic? Starting from a resonant Hacker News headline, this article explores why trust in visual records is collapsing, its costs, and possible paths to rebuilding trust through digital watermarking, detection tools, and media literacy.

Former OpenAI Researcher Christiano: AI Labs Should Solve Safety Before Pursuing Frontier Breakthroughs
AI safety researcher Paul Christiano said in an interview that US frontier AI labs should pause pretraining and reinforcement learning under their current security posture, describing algorithmic secrets as fragile with only a "12-hour lead over China."

Stop Writing Code and Your Code Review Skills Will Degrade Too
cekrem's article argues that stopping hands-on coding degrades code review skills. This analysis explores how writing and reviewing share the same judgment, how reviewers become the quality bottleneck in the AI era, and offers concrete ways to keep your coding feel.