Evenly dimming RGB LEDs?

I'm trying to dim some RGB LEDs and having trouble keeping the LEDs from changing color. For example if I have a color purple:

red=255
green=0
blue=100

And I want to dim it to it's minimum brightness, I'm multiplying by .01, which gives me:

red=2.55
green=0
blue=1

Which makes my Neopixel (WS2811) LEDs shift to red. I guess they have a minimum value of 2 per color, so the blue is ignored.

I can fix that by checking for minimum values, but before adding some kludge like that I was wondering if there's some better way to dim LED colors? Maybe converting to some other type of color value like HSV?

Thanks for any help.

As You indicate, try stepping down by some 20%, 5% when comming closer to the lowest level.
Reading the specs for the LEDs is of course good.

I guess they have a minimum value of 2 per color, so the blue is ignored.

I suspect it's not that simple. What happens if red=1? It should be easy enough to see if 200/200 gives you the same color as 20/20 or 2/2, or if everything works until you get below 2, etc.

When the numbers get small you loose resolution and there's nothing you can do about that... i.e. The difference between 1 & 2 is a factor of 2 and the difference between 0 and 1 is an infinite factor, etc. You may not be able to get white (or other color blends) at very-dim levels.

You'll probably have to do some experiments with white to find the correct "curves" or "ratios". If the corrections seem linear you can use the map() function and if they are not linear you can make a correction table (an array) to use in software.

red=2.55

Of course, the chip only responds to integers. The library is probably truncating that to 2. There's also chance that it's rounding-up, or that the decimal information is being used "wrong" and totally fouling-up the colors...

Perform some controlled tests to discouver the lower limits, if You must use them. Else, set a limit a bit higher, like 5.

8-bit PWM has it's limitations at low brightness. About 16 equal light level steps at the most.
12-bit PWM would be better.

Are you worried about the colour of each LED, or the colour of the light that the string outputs.
Clever code could use multiple LEDs at different colours to achieve a more equal room colour at low levels.
Leo..

Leo is right, changing to 12 bit PWM would be much better.
Also your RGB LED will not produce "white" light from say RGB 200 - 200 - 200
because the efficiencies of red, green and blue leds are different.
So your first step would be to do a calibration to get as near to white as you can.

Also the operating voltage for each is different, so you need to use the right resistors;
(see my page here Controlling leds withan arduino

and finally, make sure you have no filtering capacitors on the PWM.

Not sure which library you use for the neopixels. The FastLed library supports HSV which might get you closer to your goal.