Skip to content

Instantly share code, notes, and snippets.

@gblancogarcia
Created October 1, 2013 16:43
Show Gist options
  • Save gblancogarcia/6781472 to your computer and use it in GitHub Desktop.
Save gblancogarcia/6781472 to your computer and use it in GitHub Desktop.
Random UIColor
// 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