Don't complain when shrinking to a new palette.
Use a k-d tree rather than a hash table to find closest colors.

This is faster and will better support truly huge numbers of input
colors. Also generalizes to different color spaces. The output is
slightly different but may be better (because of extra precision).