Random colour generator
Random colours in any format: fully random or limited to pastel, vivid, dark, light or greyscale. Copy HEX, RGB, HSL or OKLCH with one click.
Why the styles use OKLCH
Picking random HSL values with high lightness doesn’t give consistent pastels: HSL yellow at 80% lightness looks far brighter than HSL blue at 80%. OKLCH’s lightness follows human perception, so every colour from the “Pastel” or “Dark” style has about the same visual weight. Colours outside the sRGB gamut are brought in by reducing chroma, which keeps the hue intact.
For colours that work together, use the colour palette generator.
Questions people ask
How are random colours generated?
In “Any” mode, each of the 16.7 million sRGB colours is equally likely: 24 random bits from crypto.getRandomValues. The other modes pick random OKLCH lightness, chroma and hue within limits, so “Pastel” or “Dark” colours really look pastel or dark.
Which colour formats are shown?
HEX, RGB, HSL and OKLCH for every colour. Copy any of them straight into CSS. OKLCH is supported in all current browsers.
Is the text colour on each swatch accessible?
Each swatch shows white or near-black text, whichever has the higher WCAG contrast ratio against it, and the ratio is displayed.