Hello, Thanks Daniel and Mark I'm trying to make a palette where i need

Hello,

Thanks Daniel and Mark

I’m trying to make a palette where i need move the distance between to colors:
Like :

for( i=60,i<160,i++){
DEFINE_GRADIENT_PALETTE( myPalette ) {
0, 32, 32, 32,
i, 0, 0, 0,
200,32,32,32 }
}

I know this is a wrong code, because is a DEFINE, i want to make a Gradiente palette, on the fly Is possible ? ( this code is only to show what i need…)

thanks in advance

I wrote this function that does a little bit of what you are after- see if you can adapt this-

CRGBPalette16 getPaletteMatrix(CRGB color) {
static byte gradientByte[12] = {
0, 0, 0, 0, //black
192, 0,255, 0, //green
255, 255,255,255}; //white

gradientByte[5] = color.r;
gradientByte[6] = color.g;
gradientByte[7] = color.b;

CRGBPalette16 returnPalette;
returnPalette.loadDynamicGradientPalette(gradientByte);

return returnPalette;
}

Thanks Heff, but need return/get the exactly format of DEFINE_GRADIENT_PALETTE

you are return a ( CRGBPalette16 )
but i saw the result of ( DEFINE_GRADIENT_PALETTE ) is another type

do you know about ?

This is probably closer to what you want-

for(int i = 0; i < 160; i++) {
//set up gradient
static byte gradientByte[12] = {
0, 32, 32, 32,
i, 0, 255, 0,
200, 32, 32, 32};

//load gradient into myPalette
myPalette.loadDynamicGradientPalette(gradientByte);
}

Good luck!

Hi Jeff, i will do test, but looks like is the solution…
soon i back to tell you
thank you