Created
August 8, 2016 07:21
-
-
Save zummenix/511fabc94f2dc6fbb2fe4cb6c002bc8d to your computer and use it in GitHub Desktop.
Allows to change brightness of an UIColor.
This file contains 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
private extension UIColor { | |
func addedBrightness(value: CGFloat) -> UIColor { | |
var cs: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) = (0.0, 0.0, 0.0, 0.0) | |
self.getHue(&cs.hue, saturation: &cs.saturation, brightness: &cs.brightness, alpha: &cs.alpha) | |
return UIColor(hue: cs.hue, saturation: cs.saturation, brightness: cs.brightness + value, alpha: cs.alpha) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment