noob question: I want to use some RGB color palettes I found that are

noob question:

I want to use some RGB color palettes I found that are 5 colors each with the Noise+Palettes example. How do I add these palettes to the sketch?

In the example you mention, if you wanted the purple and green palette for example you could copy lines 238-249 to your new sketch.

All the palettes mentioned on lines 174 -175 are included with FastLED, meaning they have already been created in the library code, so you can just use any of those names (LavaColors_p, PartyColors_p, etc) when ever you’d like.

I want to make my own palette colors from RGB values, how do you do that?

Instead of using CRGB::Red for example, you could use CRGB(255,0,0) for red, or adjust to any RGB value you’d like.
If you want to make your own custom named color:
CRGB colorA = CRGB(32,128,255);
CRGB colorB = CRGB(0,42,84);

Then you can use that name when making a palette.

Also see this wiki page for another color palette option:

Thanks. Now I have many custom palettes defined, palette0, palette1, etc… can I somehow put the palette names in an array like palettes[palette0, palette1, … ] so I can assign them using something like: targetPalette = CRGBPalette16( palettes [ i ] ) so I can increment i to change the target palette?

There might be a way, but I haven’t done that before. Try some stuff out and share what you discover.

@Stephen_Kramer - See lines 47, 48, 61 and 617 of the ColorWavesWithPalettes sketch by @Mark_Kriegsman at:

It shows you how to make and use an array of palettes in a sketch.

@marmil I get a compiling error for command: CRGB SFTA0 = CRGB(88,140,115); inoise8_pal_demo_fastLed:65: error: ‘SFTA0’ is not a member of ‘CRGB’



@Ken_White This is for gradient palettes, I noticed the use of TProgmemRGBGradientPalettePtr. Is there a similar definition for TProgmemPalette16Ptr ?

A gradient palette has a slightly different format (then a color palette) because it has the anchor point numbers and can have a variable number of colors.

Here’s two more post for you to check out that might be of interest.

Marc do you know why my CRGB color definition is not working? Did I make a mistake?

We might be completely guessing in the dark without seeing your code. :slight_smile: Please put it on and share the link.

Basically I saw this:
and I really like it and want to use it with my own palettes, and be able to choose the palette arbitrarily from a list during the sketch. I was using TProgmemPalette16 palettes that I defined as used in the inoise8_pal_demo.ino sketch. Can I somehow convert my TProgmemPalette16 palettes to gradient palettes so I can use the “array of palettes” functionality?

Yes. If you already have a custom CRGBPalette16 you like, copy those values into a gradient color palette. You could simplify it some or put all 16 entries in the gradient color palette.

@Stephen_Kramer - TwinkleFOX by @Mark_Kriegsman uses TProgmemRGBPalette16* and TProgmemRGBPalette16 palettes. I think this is what you are looking for. It can be found at:

See line 359 to see how to set it up.

Hey guys thanks for the help sorry for the delay lot of projects going on but I would still really like ot get this to work. I posted my code here I am getting errors about declaring the custom CRGB colors could you help me?

When you make a custom color such as your:
CRGB SFTA0 = CRGB(88,140,115);
and then use in your palette it would only be SFTA0 (not CRGB::SFTA0).

Look at the ColorPalette.ino, line 128 and 134 with “purple” for example.

Hi thanks again got rid of all of the related errors except for one. I’m not sure how to declare everything here, I’m getting a strange error: “inoise8_pal_demo_fastLed:163: error: cannot convert ‘const uint32_t* {aka const long unsigned int*}’ to ‘const uint32_t ()[16] {aka const long unsigned int ()[16]}’ in initialization”. I updated the code on the Gist page if you want to try it.

Look at the TwinkleFOX example again, line 362 for example. You are missing the “&” in your code on lines 140-142.

Ok got it. I am running Twinklefox (TW) now to test the custom colors. I have HSV colors now, and I convert them with hsv2rgb_rainbow to a RGB color. Then I put the colors into the array for TW. But even if I put all of the same color into the array it is displaying random colors. If I just do a straight fill with the color is is correct though. Any ideas?