Skip to content

Instantly share code, notes, and snippets.

@vladborovtsov
Created May 22, 2015 13:34
Show Gist options
  • Save vladborovtsov/584607d81bc961e22070 to your computer and use it in GitHub Desktop.
Save vladborovtsov/584607d81bc961e22070 to your computer and use it in GitHub Desktop.
Random bright UIColor
- (UIColor *) randomBrightColor {
UIColor *c = nil;
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black
c = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1.0f];
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment