Skip to content

Commit

Permalink
Prepare support for dynamic palette size
Browse files Browse the repository at this point in the history
Signed-off-by: Evy Bongers <[email protected]>
  • Loading branch information
EvyBongers committed Apr 21, 2024
1 parent 96d61e5 commit 0a39cc6
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,28 @@

#include <Arduino.h> // for PROGMEM

#include "kaleidoscope/device/device.h" // for cRGB
#include "kaleidoscope/plugin.h" // for Plugin
#include "kaleidoscope/device/device.h" // for cRGB, CRGB
#include "kaleidoscope/plugin.h" // for Plugin
#include "kaleidoscope/plugin/LED-Palette-Theme.h" // for LEDPaletteTheme

namespace kaleidoscope {
namespace plugin {

namespace ledpalette {
extern bool palette_defined;
extern const cRGB palette[];

template<uint8_t _color_count>
void configurePalette(cRGB const (&colors)[_color_count]) {
for (uint8_t i = 0; i < LEDPaletteTheme::getPaletteSize(); i++) {
if (i < _color_count) {
palette[i] = colors[i];
} else {
palette[i] = CRGB(0x00, 0x00, 0x00);
}
}
bool palette_defined = true;
}
} // namespace ledpalette

class DefaultPalette : public Plugin {
Expand Down

0 comments on commit 0a39cc6

Please sign in to comment.