How does the color extraction work?
The tool uses the Median Cut algorithm to extract dominant colors from your image. The image is downsampled to 200x200 pixels for speed, then all pixel colors are read via the browser Canvas API. The algorithm recursively finds the color channel (red, green or blue) with the greatest range, sorts pixels by that channel, and splits the set at the median. This repeats until the desired number of color groups is reached. Each group is averaged to produce one representative color. Colors are then sorted from lightest to darkest by perceived luminance.