refactoring to color.js