Skip to content

Instantly share code, notes, and snippets.

@jkmathew
Created August 3, 2018 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkmathew/6eddbb58a3fcb768f5068c9a1bfdf998 to your computer and use it in GitHub Desktop.
Save jkmathew/6eddbb58a3fcb768f5068c9a1bfdf998 to your computer and use it in GitHub Desktop.
//Just an initial draft
func color(for row: Int) -> UIColor {
let block = { (row: Int) -> CGFloat in
let floatValue = min(CGFloat(row), maxValue)
return floatValue / maxValue
}
let green = block(row)
let red = block(10 - row)
print("\(row) \(green) \(red)")
return UIColor(red: red, green: green, blue: 0, alpha: 1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment