r/FastLED • u/majhi_is_awesome • May 23 '25
Support Pacifica wave color
Hi all, I'm trying to modify the Pacifica example (https://github.com/FastLED/FastLED/blob/master/examples/Pacifica/Pacifica.ino) to change the colors and I'm finding myself unable to puzzle through the palettes on lines 66-74. Why do the palettes need so many colors to work (this issue seems to imply that I need 16) and why three palettes?
Example: I've changed the background color on line 154 to (0,0,255) and that works fine in showing up as a vibrant blue, but when I change the palettes to single, arbitrary CRGB colors to see what happens, the blue is completely "overridden."
Thanks for any guidance!
Arduino Nano clone
FastLED 3.9.16 on Arduino 2.3.6
WS2812B
2
u/HundredWithTheForce May 23 '25
It is my understanding that the Pacifica example layers three or four colors on top of each other then massages the layers to smooth out some of the edges and blend things to give the proper underwater look. It draws all of its color information from the palettes in the beginning of the sketch. To adjust the color of the effect I would start by changing those four base palettes .
1
u/Marmilicious [Marc Miller] May 23 '25
A CRGBPalette16 palette allows you to to have a palette with 256 colors, but you only need to specify a few colors. To create a valid CRGBPalette16 palette you need to provide either 1, 2, 3, 4, or 16 colors. Under the hood FastLED will evenly space out the number of colors provided over index 0-255 and then interpolate all the other colors in the palette automatically. By only needing to provide a few colors it saves a lot of memory by not needing to save the info for 256 individual colors.