How can I create a custom palette with 256 colors ?

How can I create a custom palette with 256 colors ?
I tried this :

CRGBPalette256 currentPalette;
currentPalette = CRGBPalette256(
green, green, black, black,
purple, purple, black, black …

I added 256 colors but it didn’t want to compile.

There’s no built-in constructor that takes 256 arguments, so after you declare it, you can assign colors into it the palette slots like this:

pal[0] = black;
pal[1] = green;
// etc

Since it’s annoying to type all the color slot numbers, I’d do this:

uint8_t i = 0;
pal[i++] = black;
pal[i++] = green;
// etc

You could also declare a (PROGMEM) array of RGB values and just copy them into the array in a loop. I believe that the ColorPalette example has some code that does this, albeit not with 256 entries.

I’ll make a note to update that example with at least one 256-entry palette.

That’s very helpful, I’m gonna try it asap, I looked in the .h file and found useful comments about memory and usage but indeed nothing about filling 256 colors.
Thank you for your time and the library.