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

◆ ColorFromPalette() [2/8]

CHSV ColorFromPalette ( const CHSVPalette256 & pal,
uint8_t index,
uint8_t brightness = 255,
TBlendType blendType = NOBLEND )

Get a color from a palette.

These are the main functions for getting and using palette colors. Regardless of the number of entries in the base palette, this function will interpolate between entries to turn the discrete colors into a smooth gradient.

Parameters
palthe palette to retrieve the color from
indexthe position in the palette to retrieve the color for (0-255)
brightnessoptional brightness value to scale the resulting color
blendTypewhether to take the palette entries directly (NOBLEND) or blend linearly between palette entries (LINEARBLEND)

Definition at line 1294 of file colorutils.cpp.

1295{
1296 CHSV hsv = *( &(pal[0]) + index );
1297
1298 if( brightness != 255) {
1299 hsv.value = scale8_video( hsv.value, brightness);
1300 }
1301
1302 return hsv;
1303}
UISlider brightness("Brightness", 255, 0, 255, 1)
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
Definition scale8.h:117
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References brightness, and scale8_video().

+ Here is the call graph for this function: