2020-08-09 08:23:11 +10:00
---
2021-10-10 03:25:00 +11:00
title: RGB Underglow Behavior
sidebar_label: RGB Underglow
2020-08-09 08:23:11 +10:00
---
## Summary
2021-10-10 03:25:00 +11:00
This page contains [RGB Underglow ](../features/underglow.md ) behaviors supported by ZMK.
2020-08-09 08:23:11 +10:00
## RGB Action Defines
2020-08-21 14:31:28 +10:00
RGB actions defines are provided through the [`dt-bindings/zmk/rgb.h` ](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/rgb.h ) header,
2020-08-09 08:23:11 +10:00
which is added at the top of the keymap file:
```
#include <dt-bindings/zmk/rgb.h>
```
This will allow you to reference the actions defined in this header such as `RGB_TOG` .
Here is a table describing the action for each define:
2020-12-15 22:13:02 +11:00
| Define | Action |
| --------------- | ---------------------------------------------------------------------------------------------- |
2022-07-03 13:02:58 +10:00
| `RGB_ON` | Turns the RGB feature on |
| `RGB_OFF` | Turns the RGB feature off |
2020-12-15 22:13:02 +11:00
| `RGB_TOG` | Toggles the RGB feature on and off |
| `RGB_HUI` | Increases the hue of the RGB feature |
| `RGB_HUD` | Decreases the hue of the RGB feature |
| `RGB_SAI` | Increases the saturation of the RGB feature |
| `RGB_SAD` | Decreases the saturation of the RGB feature |
| `RGB_BRI` | Increases the brightness of the RGB feature |
| `RGB_BRD` | Decreases the brightness of the RGB feature |
| `RGB_SPI` | Increases the speed of the RGB feature effect's animation |
| `RGB_SPD` | Decreases the speed of the RGB feature effect's animation |
| `RGB_EFF` | Cycles the RGB feature's effect forwards |
| `RGB_EFR` | Cycles the RGB feature's effect reverse |
| `RGB_COLOR_HSB` | Sets a specific [HSB (HSV) ](https://en.wikipedia.org/wiki/HSL_and_HSV ) value for the underglow |
2020-08-09 08:23:11 +10:00
2021-10-10 03:25:00 +11:00
## Behavior Binding
2020-08-09 08:23:11 +10:00
- Reference: `&rgb_ug`
2020-12-15 22:13:02 +11:00
- Parameter #1: The RGB action define, e.g. `RGB_TOG` or `RGB_BRI`
2022-07-27 22:15:46 +10:00
- Parameter #2: Only applies to `RGB_COLOR_HSB` and is the HSB representation of the color to set (see below for an example)
2020-08-09 08:23:11 +10:00
2020-12-15 22:13:02 +11:00
:::note HSB Values
2020-08-09 08:23:11 +10:00
2022-07-27 22:15:46 +10:00
When specifying HSB values you'll need to use `RGB_COLOR_HSB(h, s, b)` in your keymap file.
2020-12-15 22:13:02 +11:00
Value Limits:
- Hue values can _not_ exceed 360 (degrees)
- Saturation values can _not_ exceed 100 (percent)
- Brightness values can _not_ exceed 100 (percent)
:::
2021-10-10 03:25:00 +11:00
## Examples
2020-12-15 22:13:02 +11:00
1. Toggle underglow on/off
```
& rgb_ug RGB_TOG
```
1. Set a specific HSB color (green)
```
& rgb_ug RGB_COLOR_HSB(128,100,100)
```
2022-02-07 16:53:30 +11:00
## Split Keyboards
RGB underglow behaviors are global: This means that when triggered, they affect both the central and peripheral side of split keyboards.