Palette
Source:
Palette.h
LivePalettes¶
src/light/Palette.h:365How many SCRIPTED palettes the picker offers, and their names.
Set by Drivers from the catalog plus whatever .mlp files the device carries, because [Palette.h] knows nothing about the filesystem and must not learn: this is the same one-pointer seam Palettes::active() is.
They sort FIRST in the picker, ahead of the sixty built-ins. A scripted palette is the thing a user just wrote or downloaded, so it is what they are looking for; a built-in is always there.
Public Static Attributes¶
constexpr uint8_t kMax = 16
Public Static Methods¶
static inline uint8_t count()
static inline const char * nameAt(uint8_t i)
static inline const char * tagsAt(uint8_t i)
: What the script declared about itself, for the picker's emoji filter.
static inline void set(const char const * names, const char const * tags, uint8_t n)
: REFERENCES the caller's arrays; it does not copy them.
static inline void clear(const char *const * names = nullptr)
: Detach, for a publisher whose storage is about to go away.
static inline bool isLive(uint8_t pickerIndex)
: Scripted palettes sort LAST, after the built-ins, and the position is the whole point.
static inline uint8_t sourceIndex(uint8_t pickerIndex)
: The index into the underlying array (scripted or built-in) behind a picker index.
static inline int cmpName(const char * a, const char * b)
: Case-insensitive name order, for sorting the scripted names among themselves.
Palette¶
src/light/Palette.h:21Public Attributes¶
RGB entry = {}
Public Methods¶
inline void fromGradient(const uint8_t * stops, size_t count)
Public Static Attributes¶
constexpr uint8_t kEntries = 16
Public Static Methods¶
static inline RGB lerpRGB(const RGB & a, const RGB & b, uint8_t frac)
Palettes¶
src/light/Palette.h:225Public Static Methods¶
static inline const Palette * active()
static inline void setActiveDirect(const Palette & p)
: Restore a previously captured palette verbatim.
static inline void setActive(uint8_t index)
static inline Palette fromBuiltin(uint8_t index)
static inline uint16_t representativeHue(uint8_t index)
static inline RGB representativeRgb(uint8_t index)
static inline uint8_t nearestForRgb(uint8_t r, uint8_t g, uint8_t b)
static inline uint8_t nearestForHue(uint16_t hue, uint8_t sat)
static inline void representativeHueSat(uint8_t index, uint16_t & hueOut, uint16_t & satOut)
Builtin¶
src/light/Palette.h:176A built-in palette: its name, its gradient, and the tags the picker filters on.
tags describes what the palette LOOKS LIKE, which is the question someone scrolling sixty entries is actually asking: warm or cold, one hue or many, calm or loud. It is not a category system to be completed, and an untagged palette is a valid state rather than an omission: an empty string simply means the palette is findable by name and swatch, as it was before.
Public Attributes¶
const char * name
const uint8_t * stops
size_t len
bool rainbow
const char * tags = ""