Random Colour Generator

Press Generate and get a set of random colours. Choose Any colour for a fully random pick, or Vivid, Pastel or Dark to keep the results in a pleasant range. Click a tile to copy it, or copy the whole list in hex, RGB or HSL. Each tile shows how it reads against white and black text.

How to use the Random Colour Generator

  1. Choose a style: Any colour, Vivid, Pastel or Dark.
  2. Choose the format you want to paste: hex (#rrggbb), rgb() or hsl().
  3. Set how many colours you want, from 1 to 30, and press Generate new.
  4. Click a tile to copy one colour, or use Copy all to take the whole list.

How many colours are there?

A web colour has three channels (red, green, blue) of 256 levels each, so there are 256 x 256 x 256 = 16,777,216 colours. In Any colour mode the tool draws one number from 0 to 16,777,215 and writes it as six hex digits, so every colour is equally likely. The randomness comes from the browser's crypto.getRandomValues, with rejection sampling so no number is favoured.

Fully random colours are often muddy or harsh, because most of the RGB cube is mid-tone. That is why the styled modes exist.

Vivid, pastel and dark: random in HSL

The styled modes pick a random hue from 0 to 359 and then a random saturation and lightness inside a range, because HSL separates "which colour" from "how strong" and "how light". Vivid uses saturation 70 to 100 and lightness 40 to 60; Pastel uses saturation 55 to 85 and lightness 78 to 90; Dark uses saturation 30 to 80 and lightness 10 to 28.

Example: hsl(30, 100%, 50%) is full-strength orange. It converts to rgb(255, 128, 0), which is #ff8000 in hex. The same colour in the three formats is what the Copy format option switches between.

When random colours are the right tool

They suit placeholder data, chart series, test fixtures, generative art and breaking a creative block. For a brand or a UI, start from one colour and build a scheme with the palette generator, then check text on it with the contrast checker.

Frequently asked questions

Is it truly random?

It uses the browser's secure random source, not Math.random. For visual colours the difference does not matter; it is the same source the password tools use.

Can I get the same colours again?

No. There is no seed, so each press gives a new set. Copy the list if you want to keep it.

Will every colour have enough contrast with text?

No. Each tile shows whether white or black text reads better on it. Use the contrast checker for exact ratios.

Why do the tiles from Any colour often look dull?

Most of the 16.7 million colours are mid-tone and low in saturation. Pick Vivid or Pastel for brighter results.

Sources

Last reviewed