From 423e544097e1498f7a41fda7c28400fb5f3e76e0 Mon Sep 17 00:00:00 2001 From: rootiest Date: Mon, 6 Apr 2026 23:45:56 -0400 Subject: [PATCH] feat(q5_max): add ESC key RGB indicator for active layer Implements rgb_matrix_indicators_advanced_user to colour the ESC key (LED 0) based on the current layer: dark on BASE, blue on FN1, green on FN2, orange on FN3, purple on FN4, and red on KEEB_CTL. --- .../q5_max/ansi_encoder/keymaps/via/keymap.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/keyboards/keychron/q5_max/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q5_max/ansi_encoder/keymaps/via/keymap.c index e4deb8e18d..c1fab38491 100644 --- a/keyboards/keychron/q5_max/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q5_max/ansi_encoder/keymaps/via/keymap.c @@ -178,6 +178,35 @@ void matrix_scan_user(void) { chord_scan(); } +// RGB Matrix Indicators -------------------------------------------------- +// ESC key (LED index 0) shows which layer is active at a glance. +// BASE stays dark; each FN/control layer gets a distinct colour. +#if defined(RGB_MATRIX_ENABLE) +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + switch (get_highest_layer(layer_state)) { + case FN1: + RGB_MATRIX_INDICATOR_SET_COLOR(0, 0, 128, 255); // blue + break; + case FN2: + RGB_MATRIX_INDICATOR_SET_COLOR(0, 0, 220, 80); // green + break; + case FN3: + RGB_MATRIX_INDICATOR_SET_COLOR(0, 255, 120, 0); // orange + break; + case FN4: + RGB_MATRIX_INDICATOR_SET_COLOR(0, 180, 0, 255); // purple + break; + case KEEB_CTL: + RGB_MATRIX_INDICATOR_SET_COLOR(0, 255, 0, 0); // red + break; + default: // BASE — keep ESC dark + RGB_MATRIX_INDICATOR_SET_COLOR(0, 0, 0, 0); + break; + } + return false; +} +#endif // RGB_MATRIX_ENABLE + // Tap Dance definitions tap_dance_action_t tap_dance_actions[] = { // Tap once for Home, twice for End