A WCAG / OKLAB utility

Contrast
finder.

Given a foreground and a background, the nearest accessible color — measured perceptually in OKLAB.

iii. Preview — using suggested color
PREVIEW

The quick brown fox jumps.

Body copy at a regular reading size. Long-form content like articles, documentation, and product descriptions all sit in this size range — where contrast matters most for sustained reading.

Fine print. Footnotes, captions, metadata, and other secondary text. WCAG’s normal-text threshold (4.5:1) was set with text at this size in mind — and is the most commonly required level.

iv. Result
Original foreground
#5A7B9D copied to clipboard
Contrast ratio 3.20:1
WCAG status Fails
OKLAB · L a b — — —
Nearest compliant in OKLAB
#4A6B8D copied to clipboard
Contrast ratio 4.51:1
WCAG status Passes
ΔE OKLAB 0.052

Replaces your foreground with the nearest compliant color above.

on WCAGWhat “compliant” means.

WCAG defines minimum contrast ratios between text and its background. 4.5:1 is the standard for normal body text (AA), 3:1 covers large or bold text and UI components, and 7:1 is the stricter AAA target.

on OKLABWhy this color space.

OKLAB is perceptually uniform — equal numerical distances correspond to roughly equal visual distances. Searching here, rather than in raw RGB, finds a substitute that looks close to your original, not just one that’s mathematically near in the wrong space.

on the searchHow a match is found.

A two-pass search across the sRGB cube: a coarse sweep filters for colors meeting your contrast target, then a fine pass refines the winner. The result is the smallest perceptual jump that still passes.