Created
October 1, 2013 16:43
-
-
Save gblancogarcia/6781472 to your computer and use it in GitHub Desktop.
Random 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
// Gets a random UIColor. | |
- (UIColor *)randomColor | |
{ | |
CGFloat hue = (arc4random() % 256 / 256.0f); | |
CGFloat saturation = (arc4random() % 128 / 256.0f) + 0.5f; | |
CGFloat brightness = (arc4random() % 128 / 256.0f) + 0.5f; | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1.0f]; | |
return color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment