Search code examples
c++colorshsv

adding/mixing colors in HSV Space


I've been trying to get a visualisation going for a few days. I'm generating a diffraction image and want to color it depending on the wavelength of light.
The easiest way to get the right color was by using the HSV space with H varying with the wavelength and S,V set to 1.0
Alas, I can't find a formula/algorithm/way to mix different colors in the HSV space.

Is there a formula for mixing in HSV or maybe another comprehensible way?


Solution

  • Honestly, I'd convert the RGB, average the components and convert back to HSV.

    It's not the most efficient way, but you'll presumably have or need RGB<->HSV code and the RGB calculation is likely to be much simpler.