FastLED 3.9.15
Loading...
Searching...
No Matches

◆ fill_palette_circular()

template<typename PALETTE>
void fill_palette_circular ( CRGB * L,
uint16_t N,
uint8_t startIndex,
const PALETTE & pal,
uint8_t brightness = 255,
TBlendType blendType = LINEARBLEND,
bool reversed = false )

Fill a range of LEDs with a sequence of entries from a palette, so that the entire palette smoothly covers the range of LEDs.

Template Parameters
PALETTEthe type of the palette used (auto-deduced)
Parameters
Lpointer to the LED array to fill
Nnumber of LEDs to fill in the array
startIndexthe starting color index in the palette
palthe color palette to pull colors from
brightnessbrightness value used to scale the resulting color
blendTypewhether to take the palette entries directly (NOBLEND) or blend linearly between palette entries (LINEARBLEND)
reversedwhether to progress through the palette backwards

Definition at line 2117 of file colorutils.h.

2120{
2121 if (N == 0) return; // avoiding div/0
2122
2123 const uint16_t colorChange = 65535 / N; // color change for each LED, * 256 for precision
2124 uint16_t colorIndex = ((uint16_t) startIndex) << 8; // offset for color index, with precision (*256)
2125
2126 for (uint16_t i = 0; i < N; ++i) {
2127 L[i] = ColorFromPalette(pal, (colorIndex >> 8), brightness, blendType);
2128 if (reversed) colorIndex -= colorChange;
2129 else colorIndex += colorChange;
2130 }
2131}
UISlider brightness("Brightness", 255, 0, 255, 1)
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness=255, TBlendType blendType=LINEARBLEND)
Get a color from a palette.

References brightness, ColorFromPalette(), and LINEARBLEND.

+ Here is the call graph for this function: