I'm interpolating RGB values by transforming them into HSV space and then back into RGB. I have trouble figuring out how to achieve interpolate(green, black, 0.5) = darkgreen
.
Black has multiple representations in HSV, for example (0, 0, 0)
and (30, 0, 0)
are both black. When I convert the RGB black #000000
, I turn it into (0, 0, 0)
. When I then interpolate it with green (120, 1, 1)
, I get (60, 0.5, 0.5)
which is dark semi-saturated yellow. A similar issue exist for white.
Am I supposed to choose a different color space? I don't want to use LAB color space, because it's computationally expensive. How can I make this correct?