I'm generating random uicolor. I want to avoid light colors like yellow, light green etc... Here's my code
+ (UIColor *)generateRandom {
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
return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
}
I'm using this for uitableviewcell background color. Cell's textLabel color is white. So if the background color is light green or some other light color its not visible clearly...
How to fix this? Can we avoid generating light colors or can we find which is light color?
If we can find that is light color means I can change the textcolor to some other color...