Random Color Generator
Generate random colors instantly. Press Space for a new color. Filter by mood: pastel, dark, warm, cool.
Best for: Breaking a blank-page block by generating an unexpected starting colour, and producing random hex values to test how a component renders
Limitations: Generates colours without checking contrast, so anything used for text still needs an accessibility check afterwards
Best suited for: Designers stuck at the start of a palette who need a prompt rather than a decision
How the Random Color Generator Works
Press Generate Random Color or Space, then copy the HEX, RGB or HSL value. New Palette draws five colors with the current filter, each on its own. Every value comes from the browser's Math.random, without a seed, so a sequence cannot be replayed; the code does not use the cryptographic crypto.getRandomValues.
The Any filter computes Math.floor(Math.random() * 16777216), an integer from 0 to 16,777,215, so every hex from #000000 to #FFFFFF is equally likely. The other filters pick whole-number HSL values with rand(min, max), both ends included. Hue 360 is the same colour as hue 0, so the full-circle filters draw hues 0 to 359, which gives each of the 360 hues the same chance:
| Filter | Hue | Sat. % | Light. % | On white | On black | 4.5:1 on white | 4.5:1 on black |
|---|---|---|---|---|---|---|---|
| Any | any hex, #000000 to #FFFFFF | 1.01 to 20.82 | 1.01 to 20.71 | 36.6% | 65.3% | ||
| Light | 0 to 359 | 30 to 70 | 70 to 90 | 1.09 to 3.48 | 6.03 to 19.21 | 0% | 100% |
| Dark | 0 to 359 | 30 to 70 | 10 to 30 | 4.14 to 19.45 | 1.08 to 5.08 | about 99.9% | 0.1% |
| Saturated | 0 to 359 | 70 to 100 | 40 to 60 | 1.07 to 11.53 | 1.82 to 19.6 | 30.3% | 71.8% |
| Pastel | 0 to 359 | 20 to 40 | 78 to 90 | 1.16 to 2.08 | 10.1 to 18.16 | 0% | 100% |
| Warm | 0 to 60 | 60 to 100 | 40 to 65 | 1.07 to 7.23 | 2.91 to 19.66 | 11.8% | 90.1% |
| Cool | 180 to 260 | 40 to 80 | 40 to 65 | 1.42 to 11.52 | 1.82 to 14.81 | 48.8% | 53.8% |
The contrast columns come from 100,000 draws per filter, computed with this tool's own code (method). Math.random differs between runs, so a rerun gives slightly different shares.
What the Filters Suit
Light and Pastel never reached 4.5:1 on white in those draws but always reached it on black, so they suit backgrounds and test fills under dark text. Dark is the reverse, for white text, but not guaranteed: its lowest draw was 4.14:1 on white. Any, Saturated, Warm and Cool land on both sides of 4.5:1, which makes them useful test data for a component that must choose its own text color, and unsafe for text you place by hand.