Improved the getPalette algorithm by introducing a pre and post processing step.
The preprocessing gets rid of the random initialization for more consistent results.
Because k-means tends to return clusters of similar size the post processing
merges similar colors to provide a more varied palette.