MCPcopy Create free account
hub / github.com/FastLED/FastLED / SetupRandomPalette

Function SetupRandomPalette

examples/NoisePlusPalette/NoisePlusPalette.h:325–336  ·  view source on GitHub ↗

This function generates a random palette that's a gradient between four different colors. The first is a dim hue, the second is a bright hue, the third is a bright pastel, and the last is another bright hue. This gives some visual bright/dark variation which is more interesting than just a gradient of different hues.

Source from the content-addressed store, hash-verified

323// another bright hue. This gives some visual bright/dark variation
324// which is more interesting than just a gradient of different hues.
325void SetupRandomPalette()
326{
327 // Create a new palette with 4 random colors that blend together
328 currentPalette = CRGBPalette16(
329 CHSV( random8(), 255, 32), // Random dim hue (low value)
330 CHSV( random8(), 255, 255), // Random bright hue (full saturation & value)
331 CHSV( random8(), 128, 255), // Random pastel (medium saturation, full value)
332 CHSV( random8(), 255, 255)); // Another random bright hue
333
334 // The CRGBPalette16 constructor automatically creates a 16-color gradient
335 // between these four colors, evenly distributed
336}
337
338
339// This function sets up a palette of black and white stripes,

Callers 2

setPalettePresetMethod · 0.85

Calls 1

CRGBPalette16Class · 0.50

Tested by

no test coverage detected