Refactoring of color.js to a cleaner code