Neopixel strip - brightness and saturation

I am using a light sensor to control the brightness of a Neopixel strip. As the room illumination decreases I make the strip less bright by reducing each primary colour (RGB). However I really want to change the saturation such that as the room darkens both the total light output decreases AND the vibrancy/stridency of the colour decreases. Basically I want the total light output to go down while making the overall colour more pastel - at least that is what I think I want!

My guess is that while reducing the drive to each colour, I must also level out by some factor the differences between each making the combined effect more grey. And of course this has to occur in real-time. Basically I am looking at some form of combined brightness and saturation control.

To avoid the need for re-invention I would appreciate hearing from anyone with useful experience in this. Google churns out references to choosing pastel colours for web page layout - but that is a more static environment.

Oh, and I am not a colours expert so I may be using entirely the wrong terminology here. Sorry.

My thanks.

There are multiple ways of specifying a color. One is RGB (which is what the neopixel wants). Another is HSL, where you specify Hue, Lightness, and Saturation.

http://en.wikipedia.org/wiki/HSL_and_HSV

So your control would specify HSL or HSV, and you would translate that to RGB to feed the strips

https://github.com/mjackson/mjijackson. … script.txt

/mike

Thanks for the reply - which it is going to take me a while to get my head around.

You are suggesting that I store my colours as HSL then adjust the Lightness and/or Saturation dimensions in real time along with converting to RGB before sending to the strip. I have no idea yet what sort of overhead that is going to entail on my Spark Core (aka Arduino) but I guess it might be no more than any other approach.

A prospective complication is that I dither the colour boundaries on the strip to give better looking transitions. Maybe I should look for supporting hardware.

If you’re using an Arduino clone to drive the Neopixels, take a look at the FastLED library: http://fastled.io/

It allows colours to be specified as RGB or HSL values… it really does make doing this sort of thing very easy.