Palette Generator
Press Generate (or the space bar) for a new palette. Lock a color to keep it; the next palette is built around whatever’s locked. Click a hex code to copy it, use the pencil to pick a color by hand, and export the result as JSON, plain text, or CSS variables. The URL updates as you go, so you can link to a palette.
Loading the generator…
How it works
All the color logic is a small Rust crate compiled to a 74 KB WebAssembly module. The page’s JavaScript only keeps track of which colors are showing and which are locked.
Colors are generated in OKLCH, a perceptual color space: lightness, chroma (colorfulness), and hue, arranged so that equal steps look equal. In plain RGB, a yellow and a blue with the “same” brightness look nothing alike; in OKLCH they do. Each new palette:
- Picks a harmony scheme (analogous, complementary, split complementary, triadic, tetradic, or monochromatic) and rotates it to start at the hue of a locked color.
- Matches chroma to the locked colors, so a muted anchor gives you a muted palette.
- Spreads lightness from dark to light, skipping the levels the locked colors already cover, so there’s always contrast to work with.
- Rejects near-duplicates by measuring distance in OKLab and retrying.
- Maps into sRGB by lowering chroma until the color is displayable, which keeps the hue and lightness intact instead of clipping channels.