What Does This Color Palette Extractor Do?
This tool pulls the dominant colors out of an image you upload and hands them back as a palette you can paste into code. Upload a photograph, a screenshot, a poster, or a logo, and it analyses the actual pixels to find the colors that carry the most visual weight in that image. The result is a set of between three and eight swatches, ordered from most dominant to least, each shown with its HEX, RGB, and HSL values.
The extraction uses K-Means clustering, a standard algorithm for grouping data points into a fixed number of clusters. The image is first drawn to a canvas and downsampled so its longest side is at most 150 pixels, which keeps the analysis fast without meaningfully changing which colors dominate. Fully and mostly transparent pixels are discarded, then every remaining pixel is treated as a point in RGB space. Starting centroids are chosen with k-means++ seeding, pixels are repeatedly assigned to their nearest centroid, and each centroid is recomputed as the average of its members until the assignments stop changing or twenty iterations pass. The final centroids become your palette colors, and the number of pixels that landed in each cluster determines the ordering.
This is a palette extractor, not a color theory generator. It does not build complementary or triadic schemes from a base hue, generate tint and shade ramps, or evaluate contrast ratios. What it does is answer one question accurately: which colors is this image actually made of. All of it runs in your browser through the Canvas API, so the image is analysed locally and is never uploaded anywhere.