Each swatch shows its HEX, RGB, HSL and OKLCH codes, and a click copies the one you need. Lock a color you like and the others keep changing around it. Palette types include analogous, complementary, triadic and monochrome, all built in a perceptual color space so the steps look even. Under every swatch you see its WCAG contrast ratio with white and black text, so you know right away whether a button or a heading in that color will be readable. Your last palettes stay in this browser, and the link holds the current one for sharing.
How it works
Random colors are picked in OKLCH, the perceptual color space CSS now supports with oklch(). It has three numbers: lightness (L, 0 to 100%), chroma (C, how colorful) and hue (H, an angle from 0 to 360). Unlike HSL, equal steps in OKLCH look like equal steps to the eye: a yellow and a blue with the same L really look equally light. The generator draws L between 35% and 92%, chroma between 0.04 and 0.22 and any hue, using crypto.getRandomValues, so you get usable colors rather than mud or neon. Palettes start from one base hue. Analogous shifts it by 25 and 50 degrees either way. Complementary adds the hue opposite (plus 180 degrees). Triadic uses three hues 120 degrees apart. Monochrome keeps the hue and steps the lightness from dark to light. A locked color becomes the base, so the rest fit around it. When a color falls outside what a screen can show (the sRGB gamut), the generator lowers the chroma until it fits and keeps the hue and lightness. Contrast follows WCAG 2. Each sRGB channel is converted to linear light, then the relative luminance is L = 0.2126 R + 0.7152 G + 0.0722 B, from 0 for black to 1 for white. The contrast ratio of two colors is (lighter + 0.05) / (darker + 0.05), from 1:1 to 21:1. Normal text needs 4.5:1 for level AA and 7:1 for AAA; large text (24 px, or 18.66 px bold) needs 3:1.
Worked example
You press the space bar and get #1E90FF, a bright sky blue. Its other codes are rgb(30 144 255), hsl(210 100% 56%) and oklch(65.2% 0.190 253.2). Can you put white text on it? Its relative luminance is 0.2744. Against white (luminance 1) the ratio is (1 + 0.05) / (0.2744 + 0.05) = 3.24:1. That passes only for large text, so the swatch says "AA large text only". Against black (luminance 0) it is (0.2744 + 0.05) / (0 + 0.05) = 6.49:1, which passes AA. For a button label in this blue, black text is the safe choice, or a darker blue behind white text. You lock the blue and switch the palette type to Complementary. The four other swatches change: two lighter and darker blues, and two warm colors on the opposite side of the wheel, around hue 73 in OKLCH. Press space until you like them, then Copy as CSS variables gives you --color-1 to --color-5 ready to paste.