1 # Layer Indication Code
3 At least for RGB Light, the `layer_state_set` function is used to detect the current highest layer, and change the underglow based on that layer.
5 This works for both the regular layers, and for the default layers, too.
7 I use the sethsv variants of the commands, so that different modes can be used, as well.
9 RGB Matrix uses a custom, per board implementation, at the moment.
11 # RGB Light Startup Animation
13 On startup, if enabled, the board will cycle through the entire hue wheel, starting and ending on the default layer color.
16 void keyboard_post_init_rgb(void) {
17 #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
18 if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }
19 if (rgblight_config.enable) {
20 layer_state_set_user(layer_state);
21 uint16_t old_hue = rgblight_config.hue;
22 rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
23 for (uint16_t i = 255; i > 0; i--) {
24 rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
30 layer_state_set_user(layer_state);
34 This could probably benefit from some cleanup and better handling.
39 This enables random twinkling of the LEDs when typing.
41 # RGB Light Mod Indicators
43 Allows feedback of which mods (oneshot or otherwise) are enabled.