Some optimisation in color.js