diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/feature_rgb_matrix.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 8ba39b476..3132360a3 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -790,6 +790,26 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | |||
790 | } | 790 | } |
791 | ``` | 791 | ``` |
792 | 792 | ||
793 | Layer indicator with only configured keys: | ||
794 | ```c | ||
795 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | ||
796 | if (get_highest_layer(layer_state) > 0) { | ||
797 | uint8_t layer = get_highest_layer(layer_state); | ||
798 | |||
799 | for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { | ||
800 | for (uint8_t col = 0; col < MATRIX_COLS; ++col) { | ||
801 | uint8_t index = g_led_config.matrix_co[row][col]; | ||
802 | |||
803 | if (index >= led_min && index <= led_max && index != NO_LED && | ||
804 | keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) { | ||
805 | rgb_matrix_set_color(index, RGB_GREEN); | ||
806 | } | ||
807 | } | ||
808 | } | ||
809 | } | ||
810 | } | ||
811 | ``` | ||
812 | |||
793 | #### Examples :id=indicator-examples | 813 | #### Examples :id=indicator-examples |
794 | 814 | ||
795 | This example sets the modifiers to be a specific color based on the layer state. You can use a switch case here, instead, if you would like. This uses HSV and then converts to RGB, because this allows the brightness to be limited (important when using the WS2812 driver). | 815 | This example sets the modifiers to be a specific color based on the layer state. You can use a switch case here, instead, if you would like. This uses HSV and then converts to RGB, because this allows the brightness to be limited (important when using the WS2812 driver). |