NEARFIELD·TOOLS

Accessible color palette generator

Turn brand colours into 50–950 scales whose step numbers are a contrast rule: any two steps 500 apart pass WCAG 4.5:1, in the same hue or across hues, checked after every colour is rounded to hex.

Up to 6 colours as #rrggbb, #rgb or rgb(), with an optional name on the same line, so CSS custom properties, Sass variables and JSON tokens paste as they are. A colour without a name is named by its hue.

—
500 apart: 4.5:1, body text
—
400 apart: 3:1, large text and UI
—
700 apart: 7:1, AAA body text

Pairs that keep the rule, out of all the pairs it covers across every scale, with white counted as step 0 and black as step 1000. Every ratio is measured on the final hex values.

    Using the scale in a design? Nearfield Accessibility, our free Figma plugin, checks every text layer and component against the colour actually painted behind it and maps each finding to its EN 301 549 clause.

    The scales

    Each swatch carries its hex in white or black, whichever it passes 4.5:1 with, and the ratio below it. Every step from 500 down passes with black and every step from 500 up passes with white; 500 passes with both.

    Export

    How the steps are spaced

    WCAG measures contrast as (L1 + 0.05) / (L2 + 0.05), where L is relative luminance. Taking the logarithm turns that ratio into a distance: place every colour at log(L + 0.05) and the contrast of any two colours depends only on how far apart they are. White and black are 21:1 apart, the whole length of the line. This page divides that length into 1000 equal parts, with white at 0 and black at 1000, so two colours that are d apart have a contrast of exactly 21d/1000, whatever their hue.

    The thresholds then become distances. 4.5:1 needs 494.0, so any two steps 500 apart pass 4.5:1 (they give 4.58:1). 3:1 needs 360.8, so 400 apart passes 3:1 (3.37:1). 7:1 needs 639.2, so 700 apart passes 7:1 (8.42:1). A 50–950 scale is a set of points on that line, generated from your colour's hue, so a teal 700 on a violet 200 and a grey 100 behind a teal 600 follow the same rule as two shades of one hue. The US Web Design System uses the same three numbers for its own palette, which it grades by luminance; this page builds a scale from your colour with the rule exact.

    Step 500 sits in the middle of the line, at the square root of 21, which is 4.58:1 against both white and black. That is why every step from 500 down carries black text, every step from 500 up carries white text, and 500 carries either.

    Why the rule survives rounding to hex

    A colour has to become a hex value, and rounding each channel to the nearest of 256 levels moves its luminance a little. The 500-apart rule has only 1.8 % of margin (4.58 against 4.5), and rounding to the nearest level could spend it. So the rounding is directed. A step lighter than 500 is always rounded to a hex that is no darker than its target, and a step darker than 500 to one that is no lighter. Every pair the rule covers puts a step lighter than 500 against one darker than 500 (or 500 itself against pure white or black), so directed rounding can only move the two colours of a pair further apart. The rule holds after rounding as a matter of arithmetic, and the page checks every pair anyway, across all scales, and counts them in the three boxes above.

    Hue and chroma

    Each step keeps the hue of your base colour in OKLCH, a colour space designed so that a fixed hue angle looks like the same hue as it gets lighter or darker, which HSL does not manage for blues and purples. Lightness is solved so that the step lands on its target luminance. Chroma starts from your colour's: by default it fades toward white, to √(step / 400) of the base below 400, because the light steps are mostly backgrounds and a 50 at full chroma reads as a highlighter; choose "Same as the base colour" to keep it constant. Either way, near white and near black the screen cannot show a saturated colour at that luminance, so chroma is reduced to the most the gamut allows there. Chroma never enters the contrast, so this choice changes how the scale looks and not one ratio. Hover a swatch to see its OKLCH values. Yellows are the extreme case: a yellow dark enough for step 700 is olive or brown, because a dark yellow is what brown is. The page prints the colour that exists rather than pretending otherwise.

    Why a familiar palette does not work this way

    Most palettes number their steps by appearance, so the same step means a different contrast in each hue. In the default palette of Tailwind CSS v3, yellow-500 (#eab308) is 1.91:1 on white and gray-500 (#6b7280) is 4.83:1; the two "500"s sit 304 apart on this page's line. A rule like "use 600 or darker for text" cannot hold across hues when the steps are numbered like that. Here, the step number is the contrast.

    FAQ

    Can my brand colour be on the scale exactly?

    Tick "Put each base colour on its scale" and it replaces the step nearest to it. Your colour sits wherever its luminance puts it, so the rule then holds only approximately for that one swatch, and the page lists every pair that breaks, with its ratio. The line above the scales says where each base colour sits and which steps it can carry body text with, whether or not it is placed on the scale.

    Does a scale from this page make a design WCAG compliant?

    It guarantees which pairs of its colours have enough contrast. A design passes 1.4.3 Contrast (Minimum) and 1.4.11 Non-text Contrast, clauses 9.1.4.3 and 9.1.4.11 of EN 301 549, only if it actually uses those pairs for its text and controls, including over images and gradients. The rest of the audit is in the WCAG 2.2 checklist. To check a single pair the design really uses, the color contrast checker takes any text and background, translucent ones included.

    How do I check the scale a team already has?

    Paste it into the palette contrast checker, which grades every pair and lays the colours on the same lightness line used here, so bunched or uneven steps show at once. The "Check in the grid" link beside each scale opens it there with that scale filled in.

    Will colour-blind users still tell the hues apart?

    Contrast is a matter of luminance, so the rule holds for every viewer. Telling a teal from a grey of the same step is a different matter, covered by 1.4.1 Use of Color: two hues at the same step have, by design, the same lightness, and for protan, deutan and tritan viewers they can merge. The color blindness simulator shows which do.

    What about dark mode?

    The rule is symmetric, so dark mode uses the same scale from the other end: backgrounds from 800 to 950, text 500 or more steps lighter. Step 950 behind step 400 is 550 apart and passes 4.5:1, exactly as 50 behind 600 does.