Refactor color functions.