Skip to content

Instantly share code, notes, and snippets.

@revblaze
Created July 14, 2020 15:02
Show Gist options
  • Save revblaze/0dcc0ed012906428ee26b0c0a5cd1820 to your computer and use it in GitHub Desktop.
Save revblaze/0dcc0ed012906428ee26b0c0a5cd1820 to your computer and use it in GitHub Desktop.
Easy and quick UIColor conversion extension
extension UIColor {
static func color(_ red: Int, green: Int, blue: Int, alpha: Float) -> UIColor {
return UIColor(
red: 1.0 / 255.0 * CGFloat(red),
green: 1.0 / 255.0 * CGFloat(green),
blue: 1.0 / 255.0 * CGFloat(blue),
alpha: CGFloat(alpha))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment