Skip to content

Instantly share code, notes, and snippets.

@yuraist
Created March 13, 2019 12:34
Show Gist options
  • Save yuraist/5d49abbf249bf2ebb2d3084339a48492 to your computer and use it in GitHub Desktop.
Save yuraist/5d49abbf249bf2ebb2d3084339a48492 to your computer and use it in GitHub Desktop.
UIColor extension for simple rgb(red:green:blue) method
extension UIColor {
static func rgb(red: CGFloat, green: CGFloat, blue: CGFloat) -> UIColor {
return UIColor(red: red/255, green: green/255, blue: blue/255, alpha: 1)
}
}
@yuraist
Copy link
Author

yuraist commented Mar 13, 2019

Example of use

let color = UIColor.rgb(red: 100, green: 200, blue: 235)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment