Let my show you some results of getting hue, saturation and brightness of three UIColors.
[[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
Can anyone explain why hue, saturation, brightness of white and black color are equal? Why alpha is equals zero?
What I wanted to do in my project is generate 'darker' color from a given color by changing it brightness:
brightness = brightness * 0.8;
It works fine for any color, but it produces black color from white color. (Although I would expect a grey color).
White light contains all the wavelengths of the visible spectrum, so when the color white is being reflected, that means all wavelengths are being reflected and none of them absorbed, making white the most reflective color.
Brightness refers to intensity, distinguished by the amount of shading mixed with the hue. Any desired hue of light can be produced when various amounts of two of the primary colors of light—the primary colors being red, green, and blue—are combined mechanically, either by addition or by subtraction.
But too high contrast between design elements might give an unsettled and messy impression. Black and white create the highest contrast possible.
DESIGNING WITH BLACK AND WHITE TO COMPLETE It's been said that “opposites attract.” To put it another way: contrast creates completion. The convergence of black and white (more so than any other color combination) is an example of how two divergent colors communicate more powerfully together than they do on their own.
The reason is because +whiteColor
and +blackColor
both return colors in the greyscale colorspace, which is not compatible with the HSB colorspace. As such, -getHue:saturation:brightness:alpha:
is actually not modifying the parameters. I think you'll find you have them all set to 0.0
before calling that method. If you check the return value of -getHue:saturation:brightness:alpha:
it will tell you if it successfully converted to HSB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With