Created
June 15, 2016 10:08
-
-
Save samuelbeek/96d6be74b0bd456326c1107af4cb9888 to your computer and use it in GitHub Desktop.
Return random color (nice for debugging)
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
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