// admin tools · 17
Colour lab
Paste any CSS colour — hex, rgb(), hsl(), lab(), oklch() or a name — and get every format, with gamut warnings, a WCAG contrast checker and OKLCH palettes.
// runs locally — nothing is uploaded
Large text — 24px
Bold large text — 18.66px bold
Normal body text at 16px. The quick brown fox jumps over the lazy dog, 0123456789.
Small print at 13px — captions, footnotes and form hints.
wcag 2.x contrast
–
apca (informational)
Built from the converter colour in OKLCH: lightness follows a 50–950 ladder, chroma tapers towards the ends, hue stays fixed. Every swatch is gamut-mapped to sRGB. Click or press Enter to copy a swatch, shift-click to make it the base.
tints & shades
harmonies · hue rotated in OKLCH
export
How it works
What it does
Type or paste any CSS colour and the converter shows it as HEX, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), color(display-p3) and color(srgb-linear), each with a copy button. The --contrast tab checks text against a background using WCAG 2.x ratios and APCA. The --palette tab builds a 50–950 tint and shade scale plus harmonies and exports them as CSS custom properties or Tailwind config. Every conversion is written from the CSS Color 4 maths and runs locally. Nothing is uploaded.
How to use it
- Input accepts hex (3, 4, 6 or 8 digits), modern and legacy
rgb()/hsl()syntax,hwb(),lab(),lch(),oklab(),oklch(),color()in sRGB, linear sRGB, Display P3 and XYZ, the 148 named colours andtransparent. Hues takedeg,rad,gradorturn. - Use the native picker or the RGB, HSL and OKLCH sliders. Slider tracks preview the colour you would get at each position.
- The URL hash keeps the current colour, so you can bookmark or share it.
How the conversions work
Every colour is converted to CIE XYZ with a D65 white point, then out to each format. sRGB and Display P3 use their transfer curves and the exact matrices from the spec. CIELab and LCH are defined relative to D50, so XYZ is chromatically adapted with the Bradford transform. OKLab and OKLCH use Björn Ottosson's LMS matrices as published in CSS Color 4.
- out of gamut
- Lab, LCH and OKLCH can describe colours an sRGB screen cannot show. The tool flags them, says whether they fit in Display P3, and maps them into sRGB with the CSS Color 4 algorithm. It lowers OKLCH chroma, keeping lightness and hue, until clipping changes the colour by less than a just-noticeable difference (ΔEOK 0.02). HEX, RGB, HSL and HWB rows show that mapped value.
- WCAG ratio
- (L1 + 0.05) / (L2 + 0.05) using relative luminance. Results are truncated, not rounded, so 4.499 never passes AA. Large text means 24px regular or 18.66px bold.
- APCA Lc
- The Accessible Perceptual Contrast Algorithm (APCA-W3 0.0.98G-4g) is a candidate method for future guidelines. It depends on polarity and is shown for information only. It is not a WCAG 2 requirement.
FAQ
Why use OKLCH for palettes?
OKLCH is close to perceptually uniform. Equal steps in lightness look like equal steps, and changing lightness doesn't shift the hue the way HSL does with blues and yellows. That makes tint and shade scales more even.
Why is my HEX different from the colour I typed?
HEX can only store sRGB values from 0 to 255. If your oklch() or lab() colour sits outside sRGB, the HEX shown is the gamut-mapped equivalent. Keep the original oklch() in your CSS so wide-gamut screens can show the full colour.
How is alpha handled in the contrast check?
A translucent text colour is blended over the background first, as the browser would draw it. A translucent background is blended over white.
Does anything leave my browser?
No. All maths runs in JavaScript on this page. The only state is the colour in the URL hash, which never leaves your machine unless you share the link.