Skip to content

Instantly share code, notes, and snippets.

@allgamesallfree
Created January 12, 2016 01:58
Show Gist options
  • Save allgamesallfree/1298f8b54b49fb445aae to your computer and use it in GitHub Desktop.
Save allgamesallfree/1298f8b54b49fb445aae to your computer and use it in GitHub Desktop.
convenience init(r: Int, g: Int, b: Int, alpha: CGFloat = 1.0) {
func intToColorFloat(int: Int) -> CGFloat {
let divisor: CGFloat = 255
return CGFloat(int) / divisor
}
self.init(red: intToColorFloat(r), green: intToColorFloat(g), blue: intToColorFloat(b), alpha: alpha)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment