Skip to content

Instantly share code, notes, and snippets.

@tfrank64
Last active August 29, 2015 14:07
Show Gist options
  • Save tfrank64/f1a03028920c099b12d7 to your computer and use it in GitHub Desktop.
Save tfrank64/f1a03028920c099b12d7 to your computer and use it in GitHub Desktop.
/// Method that returns a slightly lighter color than the one passed in
///
/// :param: color color is the color we want to make ligter
/// :returns: The lighter color
func lighterColorForColor(color: UIColor) -> UIColor {
var r:CGFloat = 0, g:CGFloat = 0, b:CGFloat = 0, a: CGFloat = 0
if color.getRed(&r, green: &g, blue: &b, alpha: &a) {
return UIColor(red: min(r + colorShadeDifference, 1.0), green: min(g + colorShadeDifference, 1.0), blue: min(b + colorShadeDifference, 1.0), alpha: a)
}
return color
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment