mrnifnif
mrnifnif

Reputation: 208

UIColor saturation brightness values different from the regular saturation luminosity values of a color

Why are UIColor hsb values different from the regular hsl values of a color?

For example the color brown is hue: 0, saturation: 59%, luminosity: 41%, but the UIColor values are hue: 0, saturation: 74%, brightness: 65%

The hue is the same, but the saturation and brightness values differ. I need to use hsb initializer of UIColor for my project. Is there a conversion algorithm?

Upvotes: 0

Views: 123

Answers (1)

CodeBender
CodeBender

Reputation: 36670

A few things are going on here.

First, HSB == HSV, as discussed in this post.

Next, the HSB(V) color space and HSL color space are two different beasts. The following image can help visualize it & shows the values you are getting: enter image description here

As to how to convert them:

enter image description here

Upvotes: 2

Related Questions