CIELCH perceptual colour space class


#1

Hi,

I recently discovered the CIELCH colour space (https://en.wikipedia.org/wiki/Lab_color_space) and got quite interested. Why? Well, because it reflects how humans perceive colour.
Therefore colour blending or hue shifting in CIELCH generates much more natural colours.
LCH is an abbreviation for Lightness, Chroma(Saturation) and Hue. Those are the three colour parameters, which you can change. And that makes it quite intuitive to use (the parameters are similar to the HSV colour space. The difference being, that the HSV colour space is not perceptual).

So I have created a JUCE class, which implements the CIELCH colour space. It is called CIELCHColour. It derives from JUCE::Colour and can therefore be used in the exact same way as a JUCE Colour. But with additional functions, such as CIELCHColour::fromCIELCH() or CIELCHColour::withMultipliedCIEChroma().

If you want to try it here are links to the source and the documentation:
Source on Github: https://github.com/Alatar79/JUCE-CIELCH
Documentation:  http://alatar79.github.io/CIELCH/Doc/html/classCIELCHColour.html

The Github repository comes with a demo application, which shows how to use the CIELCHColour class. The demo compares the CIELCH colour space and the HSV colour space (HSV is already implemented in JUCE).
I have attached a screenshot of the demo, so you can see, what the CIELCH colour space looks like :-)

It is easy to use the CIELCHColour class. Here is a short example:

CIELCHColour colour = Colours::yellow;
float l, c, h;
colour.getCIELCH(l, c, h);
float newSaturation = c / 2.0f;
bool imaginary;
CIELCHColour newColour = CIELCHColour::fromCIELCH(l, newSaturation, h, colour.getAlpha(), imaginary);

 


#2

https://www.youtube.com/watch?v=xAoljeRJ3lU <-- Viridis is a new colormap that recently emerged from the IPython community. Posting as it is an interesting video.

π