Skip to content

Instantly share code, notes, and snippets.

@vladimir-anisimov
Last active April 29, 2022 11:32
Show Gist options
  • Save vladimir-anisimov/adc705a7244e006c920556d4cdf95b84 to your computer and use it in GitHub Desktop.
Save vladimir-anisimov/adc705a7244e006c920556d4cdf95b84 to your computer and use it in GitHub Desktop.
extension UIColor {
var redValue: CGFloat{ return CIColor(color: self).red }
var greenValue: CGFloat{ return CIColor(color: self).green }
var blueValue: CGFloat{ return CIColor(color: self).blue }
var alphaValue: CGFloat{ return CIColor(color: self).alpha }
convenience init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat = 1) {
self.init(red: r / 255, green: g / 255, blue: b / 255, alpha: a)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment