CSS Gradient Generator
Build linear, radial and conic gradients and copy the CSS.
Design & SEO
Pull any color out of a photo and build a palette from it.
By median-cut quantization, the same algorithm that reduced photographs to 256-color GIFs in the 1990s.
Every pixel is a point in a three-dimensional RGB space. The algorithm puts all of them in one box, finds the axis along which the colors are most spread out, and splits the box at the median value along that axis. It then repeats on the resulting boxes, always splitting the one with the greatest spread, until it has as many boxes as you asked for colors. The average of each box becomes a palette entry.
Median cut is used rather than simple frequency counting because frequency alone gives poor results: photographs contain thousands of near-identical shades, so the top six most-common colors in a landscape are usually six barely distinguishable blues. Median cut guarantees the palette spans the image’s actual color range.
Average color is the arithmetic mean of every pixel, and it is almost always a disappointing brown-grey. Averaging a vivid red sunset against a deep blue sea gives you mud, because opposite hues cancel.
Dominant colors are the colors actually present in significant quantity. A palette of six dominants from that same sunset gives you the orange, the deep blue, the pink and the near-black — which is what a person would describe if you asked them the colors in the photo.
The average is occasionally useful as a placeholder background while an image loads, since it minimizes the perceived flash. For anything else — building a brand palette, matching a UI to a hero image, picking a theme color — use the dominants.
Three reasons, and all three are worth understanding if you are matching colors precisely.
The first is JPEG compression. Chroma subsampling stores color at half resolution, so pixels near a hard color boundary carry averaged values that appear in neither original region. Sample from the middle of a flat area rather than near an edge.
The second is your display profile. A wide-gamut monitor renders sRGB values more saturated than a standard one, so the color you see is not the color in the file. The sampled value is the file’s value, which is the correct one to use.
The third is simultaneous contrast — a perceptual effect where surrounding colors shift how a color appears. A grey square looks warm on a blue background and cool on an orange one. The eyedropper reports the actual pixel value, which can genuinely differ from your perception of it.
For a brand or interface palette, five to seven works: one or two primaries, one accent, and two or three neutrals. Beyond about eight, the colors stop being individually memorable and the system becomes hard to apply consistently.
For matching a UI to a specific image — a music player themed to album art, a product page themed to a photo — three is usually enough: a dominant for the background, a contrasting one for text, and an accent.
Whatever you extract, check the contrast before using it. Two colors pulled from the same photograph frequently sit at similar luminance, which looks harmonious and fails WCAG AA badly when used as text on background. Run the pair through the Color Converter to check the ratio.
Take a screenshot and drop it here. Browsers do not allow a page to read pixels from another site for security reasons.
HEX, RGB, HSL and OKLCH for every sampled color and every palette swatch.
Yes. Transparent pixels are reported as such rather than as the checkerboard color, and are excluded from palette extraction.
The image genuinely contains two close but distinct dominant regions. Reduce the palette size and the algorithm will merge them.
Yes. The sample size control averages over a 3×3, 5×5 or 11×11 region, which is the right approach for noisy or compressed images.
Yes, though video compression is more aggressive than JPEG, so sample from flat areas for accuracy.
No. The image is drawn to a canvas in this page and pixels are read with getImageData locally.