Skip to content

Instantly share code, notes, and snippets.

@masterzen
Created September 23, 2018 14:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save masterzen/bd8627b7d1eb653b3b64a9b42adadb2c to your computer and use it in GitHub Desktop.
Save masterzen/bd8627b7d1eb653b3b64a9b42adadb2c to your computer and use it in GitHub Desktop.
QMK keymap to change rgb underglow based on Caps Lock
extern rgblight_config_t rgblight_config;
uint32_t mode;
uint16_t hue;
uint8_t sat;
uint8_t val;
void matrix_init_user(void)
{
mode = rgblight_config.mode;
}
void led_set_user(uint8_t usb_led) {
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
mode = rgblight_get_mode();
hue = rgblight_get_hue();
sat = rgblight_get_sat();
val = rgblight_get_val();
rgblight_mode_noeeprom(1);
rgblight_setrgb(0xD3, 0x7F, 0xED);
} else {
rgblight_mode(mode);
rgblight_sethsv(hue, sat, val);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment