Skip to content

Comment on How the algorithm for coloring the iTunes song list works

Comments

How I'd do it:

1. pick 500 random points from the album art

2. cluster them in 10 classes (k-means is an old, well understood algorithm)

3. pick the median point of dominant class for the bg

4. pick a contrasting color from a different cluster for the text

I wouldn't pick the median of the dominant class for the BG, but rather from the borders (even though this could work)

for 4 you want that, picking from one of the colors of the album or a contrasting color if this is not available from the album

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.