Created
September 8, 2015 04:01
-
-
Save alexbosworth/f673fc6f24c49b010fa5 to your computer and use it in GitHub Desktop.
convert a ui color to grayscale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var (hue, saturation, brightness, alpha) = (CGFloat(0.0), CGFloat(0.0), CGFloat(0.0), CGFloat(0.0)) | |
let originalColor = UIColor.redColor() | |
if originalColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) { | |
let grayscale = UIColor(hue: hue, saturation: 0, brightness: brightness, alpha: alpha) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing