Question

Am I doing this correctly? For example, I have an RGB(165,165,165) and convert it to the HSL(Get (0, 0, 64.7)). Actually I parse xml, and there I have two parameters lumMod = '60 000' and lumOff = '40 000' (As I know it means that I must multiply the L component by 0.6 and then add 0.4 to the L component)

Okey new_l = 0.647*0.6 + 0.4 = 0.7882

And now I convert back from HSL(0, 0, 78.8) to RGB(198, 198, 198)

Actually I need get RGB(183,183,183). Because it's right answer. Where I was wrong?

Was it helpful?

Solution

After all night debugging I have been founded answer for my question.

Thanks to King Salemno from this topic

The algorithm the charts are performing, the following steps are performed:

  1. Obtain RGB of the base color they’re interested in (e.g. Accent 3)

  2. Convert to HSL

  3. Multiply the L component by lumMod

  4. Add lumOff to the L component

  5. Convert back to RGB

The same logic also applies to satMod, satOff, hueMod, & hueOff.

But for rgb-color, which have only one value for all levels (like as (255, 255, 255) or (123, 123, 123)) I change lumMod to lumMod = lumMod - 0.04(+-0.005) and do the same for lumoff parameter.

So if I have RGB(165,165,165) and convert it to the HSL(0, 0, 0.647). After I change HSL.L = HSL.L*(lumMod - 0.04) + (lumOff - 0.04) = 0.718 And now I convert back from HSL(0, 0, 0.718) to RGB(183,183,183)

I don't know why it work like this, but it work. I tried to find out it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top