<p>If you've installed addressable RGB lights on your keyboard you can control them with QMK. Currently we support the following addressable LEDs on Atmel AVR processors:</p>
<ul>
<li>WS2811 and variants (WS2812, WS2812B, WS2812C, etc)</li>
<li>SK6812RGBW</li>
</ul>
<p>Some keyboards come with RGB LEDs pre-installed. Others have to have LEDs installed after the fact. See below for information on modifying your keyboard.</p>
<p>QMK uses Hue, Saturation, and Value to set color rather than using RGB. You can use the color wheel below to see how this works. Changing the Hue will cycle around the circle. Saturation will affect the intensity of the color, which you can see as you move from the inner part to the outer part of the wheel. Value sets the overall brightness.</p>
<imgsrc="gitbook/images/color-wheel.svg"alt="HSV Color Wheel"width="250">
<p>If you would like to learn more about HSV you can start with the <ahref="https://en.wikipedia.org/wiki/HSL_and_HSV"class="Link--external">Wikipedia article</a>.</p>
<h2id="page_Configuration">Configuration</h2>
<p>Before RGB Lighting can be used you have to enable it in <code>rules.mk</code>:</p>
<pre><code>RGBLIGHT_ENABLE = yes
</code></pre>
<p>You can configure the behavior of the RGB lighting by defining values inside <code>config.h</code>.</p>
<p>You can change the behavior of the RGB Lighting by setting these configuration values. Use <code>#define <Option><Value></code> in a <code>config.h</code> at the keyboard, revision, or keymap level.</p>
<table>
<thead>
<tr>
<th>Option</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RGBLIGHT_HUE_STEP</code></td>
<td>10</td>
<td>How many hues you want to have available.</td>
</tr>
<tr>
<td><code>RGBLIGHT_SAT_STEP</code></td>
<td>17</td>
<td>How many steps of saturation you'd like.</td>
</tr>
<tr>
<td><code>RGBLIGHT_VAL_STEP</code></td>
<td>17</td>
<td>The number of levels of brightness you want.</td>
</tr>
<tr>
<td><code>RGBLIGHT_LIMIT_VAL</code></td>
<td>255</td>
<td>Limit the val of HSV to limit the maximum brightness simply.</td>
</tr>
<tr>
<td><code>RGBLIGHT_SLEEP</code></td>
<td></td>
<td><code>#define</code> this will shut off the lights when the host goes to sleep</td>
<td></td>
</tr>
</tbody>
</table>
<h3id="page_Animations">Animations</h3>
<p>If you have <code>#define RGBLIGHT_ANIMATIONS</code> in your <code>config.h</code> you will have a number of animation modes you can cycle through using the <code>RGB_MOD</code> key. You can also <code>#define</code> other options to tweak certain animations.</p>
<table>
<thead>
<tr>
<th>Option</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RGBLIGHT_ANIMATIONS</code></td>
<td></td>
<td><code>#define</code> this to enable animation modes.</td>
<td>How many LED's to group the red/green colors by for the christmas mode.</td>
</tr>
</tbody>
</table>
<p>You can also tweak the behavior of the animations by defining these consts in your <code>keymap.c</code>. These mostly affect the speed different modes animate at.</p>
<pre><codeclass="language-c">// How long (in ms) to wait between animation steps for the breathing mode
<p>Look in <code>rgblights.h</code> for all available functions, but if you want to control all or some LEDs your goto functions are:</p>
<pre><codeclass="language-c">rgblight_disable(); // turn all lights off
rgblight_enable(); // turn lights on, based on their previous state (stored in EEPROM)
rgblight_setrgb(r, g, b); // where r/g/b is a number from 0..255. Turns all the LEDs to this color
rgblight_sethsv(h, s, v); // HSV color control - h is a value from 0..360 and s/v is a value from 0..255
rgblight_setrgb_at(r,g,b, LED); // control a single LED. 0 <= LED < RGBLED_NUM
rgblight_sethsv_at(h,s,v, LED); // control a single LED. 0 <= LED < RGBLED_NUM
</code></pre>
<p>You can find a list of predefined colors at <ahref="https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h"class="Link--external"><code>quantum/rgblight_list.h</code></a>. Free to add to this list!</p>
<p><imgsrc="https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg"alt="Planck with RGB Underglow"/></p>
<p>Here is a quick demo on Youtube (with NPKC KC60) (https://www.youtube.com/watch?v=VKrpPAHlisY).</p>
<p>For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring the VCC, GND, and DI, you can enable the underglow in your Makefile.</p>
<pre><code>RGBLIGHT_ENABLE = yes
</code></pre>
<p>In order to use the underglow animation functions, you need to have <code>#define RGBLIGHT_ANIMATIONS</code> in your <code>config.h</code>.</p>
<p>Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the <code>F4</code> pin by default:</p>
<pre><code>#define RGB_DI_PIN F4 // The pin your RGB strip is wired to
#define RGBLED_NUM 14 // Number of LEDs
</code></pre>
<p>You'll need to edit <code>RGB_DI_PIN</code> to the pin you have your <code>DI</code> on your RGB strip wired to.</p>