I have hue, saturation and value of a color (HSV color-space). The color has to be set on a device that displays them incorrectly. If I specify white it displays light magenta. However, if you specify some green it displays the best white it can (let's say: gray). How do I remove this color cast? Actually: How do I create a color cast in the HSV numbers to compensate for the wrong display?
My approach was the following. But it lead to a skip of some magenta colors, when I ran through the whole rainbow with a saturation of, say, 0.8 (interval 0 to 1):
- Shift magenta to the beginning of the hue scale (60 degrees forward) and thus the hue of the current color
- Calculate the distance to move in the direction of green. With a saturation of 1 that means to move completely to green (180 degrees).
- This is the formula: distance = (180 / 360 - shifted_hue) * (1 - saturation)
- Then add the distance to the shifted hue (possibly resulting in a subtraction).
- Shift the hue scale back by 60 degrees.
As said, this is leading to an ugly skip of some magenta colors, because the lower the saturation the bigger the gap at magenta.
Do you know of a better algorithm?