You can set the color by using the RGB keycodes. You can see which RGB keycodes to use at the QMK documentation.
Your keyboard contains a little piece of memory called the EEPROM. This memory works even when you power the keyboard down, so it will remember data when you unplug and replug the keyboard. The RGB keycodes write the current RGB status to this piece of memory, which should cause your keyboard to retain the same color it was set to the last time.
Sometimes you may have different requirements, though.
You can use the following code block in your keymap.c
file to set the RGB underglow manually:
#ifdef RGBLIGHT_ENABLE void keyboard_post_init_user(void) {
rgblight_enable_noeeprom(); // Enables RGB, without saving settings rgblight_sethsv_noeeprom(HSV_PURPLE);
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); } #endif
The ifdef
parts are to make sure that your code still compiles if you decide to disable RGB underglow.
You can check the list of predefined colors at the QMK documentation.
If you use the HSV method to set the color, you should use the HSV constants or the right parameters. The same goes for the RGB method. Using the wrong kind of constant might give you a compile error or a surprise color when turning on your keyboard.