From 23e36e348228e0cdd9524441986c08305ab35376 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 15 Jun 2024 11:41:09 +0200 Subject: [PATCH] Have ColormapOverlay support blank keys Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap-Overlay.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 d0cda221f4..e71adbe246 100644 --- a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp +++ b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp @@ -35,19 +35,24 @@ void ColormapOverlay::setup() { } bool ColormapOverlay::hasOverlay(KeyAddr k) { + uint8_t top_layer = Layer.mostRecent(); uint8_t layer_index = Layer.lookupActiveLayer(k); + + bool found_match_on_lower_layer = false; for (uint8_t i{0}; i < overlay_count_; ++i) { Overlay overlay = overlays_[i]; if (overlay.addr == k) { - if ((overlay.layer == layer_index) || - (overlay.layer == layer_wildcard)) { + if ((overlay.layer == top_layer) || (overlay.layer == layer_wildcard)) { selectedColor = ::LEDPaletteTheme.lookupPaletteColor(overlay.palette_index); return true; + } else if (overlay.layer == layer_index) { + selectedColor = ::LEDPaletteTheme.lookupPaletteColor(overlay.palette_index); + found_match_on_lower_layer = true; } } } - return false; + return found_match_on_lower_layer; } EventHandlerResult ColormapOverlay::onSetup() {