Skip to content

Instantly share code, notes, and snippets.

@samuelbeek
Created June 15, 2016 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelbeek/96d6be74b0bd456326c1107af4cb9888 to your computer and use it in GitHub Desktop.
Save samuelbeek/96d6be74b0bd456326c1107af4cb9888 to your computer and use it in GitHub Desktop.
Return random color (nice for debugging)
extension UIColor {
static func randomColor(alpha: CGFloat?) -> UIColor {
let red:CGFloat = CGFloat(drand48())
let green:CGFloat = CGFloat(drand48())
let blue:CGFloat = CGFloat(drand48())
return UIColor(red: red, green: green, blue: blue, alpha: alpha ?? 1.0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment