Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@alexpersian
Last active June 1, 2019 21:33
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 alexpersian/ebaa386f67101e74e4955d6aa2e97c10 to your computer and use it in GitHub Desktop.
Save alexpersian/ebaa386f67101e74e4955d6aa2e97c10 to your computer and use it in GitHub Desktop.
extension UIColor {
static func generateRandomColor() -> UIColor {
let hue = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
return UIColor(hue: hue, saturation: 1, brightness: 1, alpha: 1) // Max saturation, max brightness
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment