Hello! Please, give me link or write some words about palettes customization.

Hello! Please, give me link or write some words about palettes customization.
I’m understand this:
DEFINE_GRADIENT_PALETTE( ib_jul01_gp ) {
0, 194, 1, 1,
128, 1, 29, 18,
255, 113, 1, 1};
First column - it is “coordinates” from 0 to 255, where to put color. Color data - it is next 3 columns.
In example above: start(0) palette at zero position with RGB 194:1:1
In middle (128) - RGB value 1:29:18
At the end (255) - RGB value 113:1:1
All colors between this coordinates FastLED will calculate themselves.

I found another way to define custom pallete:
CRGBPalette16 gPal1_p = CRGBPalette16( CRGB::Black, CRGB::Blue, CRGB::Aqua, CRGB::White);
As I understand - I can put just FOUR colors. If I put more - there are compile errors.

But in FastLED source code pallettes definitions are make with one else more way:
http://fastled.io/docs/3.1/colorpalettes_8cpp_source.html

43 extern const TProgmemRGBPalette16 LavaColors_p FL_PROGMEM =
44 {
45 CRGB::Black,
46 CRGB::Maroon,
47 CRGB::Black,
48 CRGB::Maroon,
49
50 CRGB::DarkRed,
51 CRGB::Maroon,
52 CRGB::DarkRed,
53
54 CRGB::DarkRed,
55 CRGB::DarkRed,
56 CRGB::Red,
57 CRGB::Orange,
58
59 CRGB::White,
60 CRGB::Orange,
61 CRGB::Red,
62 CRGB::DarkRed
63 };

Here is 4 groups with 4 or 3 values group.
Please, tell me what is mean?

Aslo, I found one more way to define palettes:

const TProgmemRGBPalette16 gPal1_p FL_PROGMEM =
{
Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
Ice_Blue1, Ice_Blue1, Ice_Blue1, Ice_Blue1,
Ice_Blue2, Ice_Blue2, Ice_Blue2, Ice_Blue3
};

Four groups and four values each.
How this will calculated in gradient from 0 to 255?

Thanks!

Under the covers, a palette is actually an array of 16 CRGB objects. As you found, there are a few ways to create one. The first two methods use interpolation to determine the 16 RGB values, while the last two methods assign them directly.

@Jeff_Hannan Is it possible to assign not all 16 CRGB objects, but just 4, or 7 or 15?
Would it been “remapped” to all 0…255 gradient width like it process with DEFINE_GRADIENT_PALETTE command?

And one more question: Is there any way to make palette, witch I can change dynamically while playing animation? I want to change palette with web browser with ESP8266 controller.
Please, give me piece of code, that can change palette while playing animation (for example - Fire2012 sketch)
Something like this:
DEFINE_GRADIENT_PALETTE( Var_Pal )
{
0, v1_1, v1_2, v1_3,
128, v2_1, v2_2, v2_3,
255, v3_1, v3_2, v3_3,
};

How do I need to set palette or CRGB array?

In other part of code I will change vX_Y vars, I know how to do this. But I don’t know how and what I need to initialize, for have ability use this in code like “standard FastLED palette” and change it while playing.

I want to pick colors for palette for my animation with web, and then I will hard-code it to something like DEFINE_GRADIENT_PALETTE( Var_Pal )
Thanks a lot!

Google+ is not a nice place to post code, but it actually is quite easy

DEFINE_GRADIENT_PALETTE(testPalette) {
0, 33, 55, 153,
25, 80, 119, 197,
89, 153, 215, 250,
95, 199, 233, 252,
102, 255, 255, 255,
120, 197, 219, 240,
147, 150, 187, 223,
200, 159, 171, 172,
255, 169, 154, 128
};

CRGBPalette16 activePalette = testPalette;

because this works very well with only two colours or twenty three colours, also great with palettes fetched from here http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Sunset_Real.png.index.html with the FastLED palette knife method.

@Andreas_Hopf Thanks a lot! I think, that DEFINE_GRADIENT_PALETTE and CRGBPalette16 - are very different methods and it is not so easy to use them. I find many examples. but no one use this methods together.
Very well! I think this would help me very well ))
Sorry for pore English. Thanks one time more!

@fa25514ad7a4d6321c2d Here is another example for you.

@marmil , Thank you! That is all I need! You hit the mark! ))
I don’t want to make new topic, but may be you can help me one more time?! :slight_smile:
does FastLED able to map CRGB arrays like “map” function?
I mean next: I want to copy large part of leds array to smaller one.
[ leds(10,19) = leds(0,9) ] will work, i know.
But is there any way to copy
[ leds(10,19) = leds(0,5) ] with interpolation? I need result like map function [ map(leds, 10, 19, 0, 5) ]

I put 3 led strips physically parallel each one, but connected serial on data line. Left strip is 20 leds, middle - 30, right - 20. Middle start, then data go to left (left is upside down), and then data go to right strip.
I’m calculating animation just for middle strip and then copy [ leds(5,25) = leds(50,31); leds(5,25) = leds(51,70) ]
But I think, that if I will not just copy, but if MAP!!! leds data - it would be more beautify.
Thanks. Sorry for pore English.

@fa25514ad7a4d6321c2d That’s an interesting problem. I have not seen any sort of “CRGB mapping” function before. You might have to create your own. Maybe process the individual R, G, B channels with map functions and then create the new color. Or maybe create custom gradients per frame based on certain pixels from the center strip using fill_gradient function.

http://fastled.io/docs/3.1/group___colorutils.html

Looking forward to seeing some photos or video of your project when finished.

@marmil I will post my completed code.
All I want is to make animation “wide”
Look to link and you will understand.
I need palettes, because I want not standard look of Fire effect. I want different colors and I take Jason Coon’s code for wi-fi, for web interface to change vars to see how I need to setup palette to look well.
I’m very pore programmer. I know a little, because I’m interesting with addressable leds about 5 years and I read many-many code of projects. Also I read C books, but my brain doesn’t take info as was 15-20 years ago )
For me - C was made for simplifying FastLED coding LOL.
I can not make my own function for CRGB mapping. It is too difficult for me.
May be we will see it in future versions of FastLED library )
For now, I will just copy one part of array to other.
Also, I will try to duplicate “fire” procedure to light other strip parts, but I’m not sure that it will looks fine.
Thanks for your examples and help!
Sorry for pore English.
https://plus.google.com/103347945656709911330/posts/HoT75ojHK1z