diff --git a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp index 5e66b2626d..2f1d77a33a 100644 --- a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp +++ b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp @@ -24,6 +24,7 @@ #include "kaleidoscope/key_defs.h" // for Key, KEY_FLAGS, Key_NoKey, LockLayer #include "kaleidoscope/layers.h" // for Layer, Layer_ #include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include // for LEDPaletteTheme namespace kaleidoscope { namespace plugin { @@ -35,7 +36,7 @@ bool ColormapOverlay::hasOverlay(KeyAddr k) { if (overlay.addr == k) { if ((overlay.layer == layer_index) || (overlay.layer == layer_wildcard)) { - selectedColor = &overlay.color; + selectedColor = ::LEDPaletteTheme.lookupPaletteColor(overlay.palette_index); return true; } } @@ -51,7 +52,7 @@ EventHandlerResult ColormapOverlay::onSetup() { void ColormapOverlay::setKeyboardLEDColors() { for (auto key_addr : KeyAddr::all()) { if (ColormapOverlay::hasOverlay(key_addr)) { - ::LEDControl.setCrgbAt(KeyAddr(key_addr), *selectedColor); + ::LEDControl.setCrgbAt(KeyAddr(key_addr), selectedColor); } else { ::LEDControl.refreshAt(KeyAddr(key_addr)); } diff --git a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h index 7dcfc148f1..2e9b1413fe 100644 --- a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h +++ b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h @@ -30,17 +30,14 @@ namespace plugin { // Data structure for an individual qukey struct Overlay { - // The layer this qukey is mapped on. int8_t layer; - // The keyswitch address of the qukey. KeyAddr addr; - // The alternake Key value this qukey should use (when held). - cRGB color; + uint8_t palette_index; // This is the constructor that should be used when creating a Overlay that // will be used by ColormapOverlay - constexpr Overlay(int8_t layer, KeyAddr k, cRGB color) - : layer(layer), addr(k), color(color) {} + constexpr Overlay(int8_t layer, KeyAddr k, uint8_t palette_index) + : layer(layer), addr(k), palette_index(palette_index) {} }; class ColormapOverlay : public kaleidoscope::Plugin { @@ -64,7 +61,7 @@ class ColormapOverlay : public kaleidoscope::Plugin { private: Overlay const *overlays_; uint8_t overlay_count_; - cRGB *selectedColor; + cRGB selectedColor; bool hasOverlay(KeyAddr k); void setKeyboardLEDColors();