Convert color array to function