Hello, I want to read 7 colors from the current Palette.

Hello,

I want to read 7 colors from the current Palette.

For testing purposes I defined a simple Black / White Palette, please find the code here:

https://pastebin.com/HLf7ig80

Now the output for each index is (Values are R;G;B):

Index: 0
0;0;0;

Index: 42
44;44;44;

Index: 85
90;90;90;

Index: 127
135;135;135;

Index: 170
180;180;180;

Index: 212
225;225;225;

Index: 255
15;15;15;

Anyone has an idea why the values of index 255 is 15;15;15 instead of 255;255;255?

Changing / Turning off Corrections and Blending doesn’t help.

Regards Matthias

Edit: I’m on Teensy 3.2

In order to support smooth blending for “circular” palettes, each color blends with “the next”, and in the case of the last color, “the next” is the first color since it wraps around, so the last 15 numbers are blending back to 0. Use 240 as your last value to avoid blending.

If you would still like to code using a 0-255 range but have the output maximum be 240 and avoid wrapping you can use the scale8 function:
CRGB c = ColorFromPalette( myPal, scale8( i , 240 ) );

Thank you, for the super fast reply, now it makes sense. :slight_smile: Maybe here’s a good place to mention this? :slight_smile: https://github.com/FastLED/FastLED/wiki/Gradient-color-palettes