refactor color functions