About Random Color Generator
This random color generator gives you between 1 and 24 colors per press, shown as swatches and listed as text in three notations at once: a hex code such as #6ecfb3, the matching rgb(110, 207, 179) and the matching hsl(163, 50%, 62%). Four styles control the look. The default, Any colour, allows a wide band of saturation and lightness, Vivid keeps colors saturated, Pastel keeps them light and soft, and Dark keeps them deep. The colors are picked in HSL, with a random hue from the full 360 degree wheel, then converted to hex and RGB, so all three values on a line describe the same color. Six colors are already waiting when the page opens.
What each style produces: saturation and lightness ranges
Hue is always random from 0 to 359 degrees. The style only limits how saturated and how light the color can be.
| Style | Saturation | Lightness | Looks like | Typical use |
|---|---|---|---|---|
| Any colour | 30% to 95% | 25% to 80% | Mixed: muted and bold, mid-dark to light | Exploring, test data, variety |
| Vivid | 75% to 95% | 45% to 58% | Bold, fully colored | Accents, buttons, chart series |
| Pastel | 45% to 70% | 78% to 88% | Soft, light tints | Backgrounds, tags, avatars |
| Dark | 35% to 70% | 18% to 32% | Deep, low-light shades | Dark theme panels, headers |
Saturation and lightness are whole percentages picked evenly within each range.
Random color examples in hex, RGB and HSL
Real output from the tool, three colors per style. Your colors will differ on every press.
Any colour
How many colours 3, Style Any colour
#6ecfb3 rgb(110, 207, 179) hsl(163, 50%, 62%) | #394f84 rgb(57, 79, 132) hsl(222, 40%, 37%) | #2113be rgb(33, 19, 190) hsl(245, 82%, 41%)
Vivid
How many colours 3, Style Vivid
#2be9b3 rgb(43, 233, 179) hsl(163, 81%, 54%) | #1b54da rgb(27, 84, 218) hsl(222, 78%, 48%) | #1e0bef rgb(30, 11, 239) hsl(245, 91%, 49%)
Pastel
How many colours 3, Style Pastel
#c4ede2 rgb(196, 237, 226) hsl(163, 53%, 85%) | #b4c2e4 rgb(180, 194, 228) hsl(222, 48%, 80%) | #b4afee rgb(180, 175, 238) hsl(245, 65%, 81%)
Dark
How many colours 3, Style Dark
#256553 rgb(37, 101, 83) hsl(163, 46%, 27%) | #202d4b rgb(32, 45, 75) hsl(222, 40%, 21%) | #1b155b rgb(27, 21, 91) hsl(245, 63%, 22%)
These four sets share the hues 163, 222 and 245 degrees, which shows how one hue changes character from style to style.
Hex vs RGB vs HSL: which value to copy
| Notation | Example | What the numbers mean | Good for |
|---|---|---|---|
| Hex | #394f84 | Red, green and blue as two hex digits each (00 to ff) | CSS, design tools, brand guides |
| RGB | rgb(57, 79, 132) | Red, green and blue as 0 to 255 | CSS, canvas and image code, LEDs |
| HSL | hsl(222, 40%, 37%) | Hue 0 to 359 degrees, saturation and lightness as percentages | Adjusting a color by hand: lighter, darker, more muted |
All three examples are the same blue. The values can be pasted into a stylesheet exactly as shown.
Why the colors are picked in HSL instead of random hex digits
The obvious way to make a random hex code is to pick six random hex digits. That treats every one of the 16,777,216 codes equally, so a set can include dull grayish tones and colors so dark or so pale that they are hard to tell apart as swatches.
This tool picks three different numbers instead: a hue angle from 0 to 359, a saturation percentage and a lightness percentage. Hue decides which color it is (0 is red, 120 is green, 240 is blue), saturation decides how strong it is, and lightness decides how close it sits to black or white. Keeping saturation and lightness inside a band, and letting only the hue roam freely, is what makes a set of six swatches look like they belong together.
The hex and RGB values are then calculated from the HSL value. Because RGB channels are whole numbers, converting the hex code back to HSL in another program can give a result that differs by one percent here or there. The color on screen is the same.
Things to know before using random colors in a design
- Each color in a set is picked independently. The tool does not build harmonies such as complementary or triadic schemes, and two swatches in one set can land on similar hues.
- Random text and background pairs often fail accessibility checks. Body text needs a contrast ratio of at least 4.5:1 against its background under WCAG AA, so test any pair before shipping it.
- Every Pastel swatch is light enough for black text to pass 4.5:1, and nearly every Dark swatch is deep enough for white text, although the lightest dark yellows, greens and cyans (lightness 29% and above) fall short. Vivid and Any colour results vary too much to assume either.
- A set cannot be brought back once you press Generate again, and there is no option to lock a swatch. Copy the Values block when you see colors you want to keep.
- The same hex code can look different on two screens, because displays vary in calibration and color gamut. The code itself is what stays constant.
How to use it
- 1
Set How many colours to the number of swatches you want, from 1 to 24.
- 2
Choose a Style: Any colour, Vivid, Pastel or Dark.
- 3
Press Generate. The Colours panel shows the swatches, each labeled with its hex code.
- 4
Copy the Values block. Each line holds one color as hex, rgb() and hsl(), in that order.
- 5
Press Generate again for a completely new set. Reset puts the settings back to six colors in the Any colour style and clears the results until you press Generate.