Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created January 4, 2016 06:28
Show Gist options
  • Save mortenjust/5b8c150917bc04edbddb to your computer and use it in GitHub Desktop.
Save mortenjust/5b8c150917bc04edbddb to your computer and use it in GitHub Desktop.
hsb, hsba, uicolor
func getHSBA(color:UIColor) -> (hue:CGFloat, saturation:CGFloat, brightness:CGFloat, alpha:CGFloat) {
var hue:CGFloat = 0.0
var sat:CGFloat = 0.0
var bri:CGFloat = 0.0
var alpha:CGFloat = 0.0
color.getHue(&hue, saturation: &sat, brightness: &bri, alpha: &alpha)
return (hue:hue, saturation:sat, brightness:bri, alpha:alpha)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment