Objective-c: How to create different shades of color

Is there any algorithm that will create different shades for a given Hex or RGB value? I tried with increasing and decreasing alpha, but it does not look good with light colors (for example: white).

enter image description here

+4
source share
1 answer

The best way to do this is to use the HSB color space.

As I did the left side of the keyboard in my last application ...

enter image description here

The “shadow” of color is the meaning of Hand S. Then you can change the brightness by adjusting the value B.

So, if you have a color like ...

HSB - 0.5, 0.9, 0.9 - very light blue

, B...

HSB - 0.5, 0.9, 0.3 - - .

HSB, ...

UIColor *color = [UIColor colorWithHue:0.5 saturation:0.9 brightness:0.4 alpha:1.0];

" " " ".

, .

for, .

+10

All Articles