让我向您展示一些获取三种 UIColor 的色调、饱和度和亮度的结果。
[[UIColor redColor] getHue:&hue
saturation:&saturation
brightness:&brightness
alpha:&alpha];
hue = 1.0 saturatino = 1.0 brightness = 1.0 alpha = 0.0
[[UIColor whiteColor] getHue:&hue
saturation:&saturation
brightness:&brightness
alpha:&alpha];
hue = 0.0 saturatino = 0.0 brightness = 0.0 alpha = 0.0
[[UIColor blackColor] getHue:&hue
saturation:&saturation
brightness:&brightness
alpha:&alpha];
hue = 0.0 saturatino = 0.0 brightness = 0.0 alpha = 0.0
谁能解释为什么白色和黑色的色调,饱和度,亮度相等?为什么阿尔法等于零?
我想在我的项目中做的是通过改变给定颜色的亮度来生成“较深”的颜色:
亮度 = 亮度 * 0.8;
它适用于任何颜色,但它会从白色产生黑色。(虽然我希望是灰色的)。