How the dominant colors are actually found#
Every pixel is rounded to one of 8 levels per RGB channel — a 512-cube grid — and pixels landing in the same cube are counted together and averaged. The most populated cubes become the swatches. This is a histogram over real pixel data, explainable and honest about what it does, not a perceptual clustering algorithm claiming to find "the" definitive palette — different images can genuinely have more than one reasonable answer.