refactor colorFunc