Refactor custom colorizer for kmeans