qmk_firmware/features/rgblight.html

143 lines
175 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>RGB Lighting | QMK Firmware</title>
<meta name="description" content="Documentation for QMK Firmware">
<meta name="generator" content="VitePress v1.1.3">
<link rel="preload stylesheet" href="/assets/style.No8zk9aC.css" as="style">
<script type="module" src="/assets/app.DQznqO_F.js"></script>
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="modulepreload" href="/assets/chunks/framework.DyMmIvSC.js">
<link rel="modulepreload" href="/assets/chunks/theme.BbG4GfFx.js">
<link rel="modulepreload" href="/assets/chunks/color-wheel.DIUCmfNZ.js">
<link rel="modulepreload" href="/assets/features_rgblight.md.DehQikiL.lean.js">
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
</head>
<body>
<div id="app"><div class="Layout" data-v-5d98c3a5><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5d98c3a5 data-v-ae24b3ad><div class="VPNavBar has-sidebar top" data-v-ae24b3ad data-v-ccf7ddec><div class="wrapper" data-v-ccf7ddec><div class="container" data-v-ccf7ddec><div class="title" data-v-ccf7ddec><div class="VPNavBarTitle has-sidebar" data-v-ccf7ddec data-v-ab179fa1><a class="title" href="/" data-v-ab179fa1><!--[--><!--]--><!--[--><!--[--><!--[--><img class="VPImage dark logo" src="/qmk-logo-dark.svg" alt data-v-8426fc1a><!--]--><!--[--><img class="VPImage light logo" src="/qmk-logo-light.svg" alt data-v-8426fc1a><!--]--><!--]--><!--]--><span data-v-ab179fa1>QMK Firmware</span><!--[--><!--]--></a></div></div><div class="content" data-v-ccf7ddec><div class="content-body" data-v-ccf7ddec><!--[--><!--]--><div class="VPNavBarSearch search" data-v-ccf7ddec><!--[--><!----><div id="local-search"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><span class="vp-icon DocSearch-Search-Icon"></span><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-ccf7ddec data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="./" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>Home</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-ccf7ddec data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-e6aabb21 data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-ccf7ddec data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://reddit.com/r/olkb" aria-label target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 29 3 C 28.0625 3 27.164063 3.382813 26.5 4 C 25.835938 4.617188 25.363281 5.433594 25 6.40625 C 24.355469 8.140625 24.085938 10.394531 24.03125 13.03125 C 19.234375 13.179688 14.820313 14.421875 11.28125 16.46875 C 10.214844 15.46875 8.855469 14.96875 7.5 14.96875 C 6.089844 14.96875 4.675781 15.511719 3.59375 16.59375 C 1.425781 18.761719 1.425781 22.238281 3.59375 24.40625 L 3.84375 24.65625 C 3.3125 26.035156 3 27.488281 3 29 C 3 33.527344 5.566406 37.585938 9.5625 40.4375 C 13.558594 43.289063 19.007813 45 25 45 C 30.992188 45 36.441406 43.289063 40.4375 40.4375 C 44.433594 37.585938 47 33.527344 47 29 C 47 27.488281 46.6875 26.035156 46.15625 24.65625 L 46.40625 24.40625 C 48.574219 22.238281 48.574219 18.761719 46.40625 16.59375 C 45.324219 15.511719 43.910156 14.96875 42.5 14.96875 C 41.144531 14.96875 39.785156 15.46875 38.71875 16.46875 C 35.195313 14.433594 30.800781 13.191406 26.03125 13.03125 C 26.09375 10.546875 26.363281 8.46875 26.875 7.09375 C 27.164063 6.316406 27.527344 5.757813 27.875 5.4375 C 28.222656 5.117188 28.539063 5 29 5 C 29.460938 5 29.683594 5.125 30.03125 5.40625 C 30.378906 5.6875 30.785156 6.148438 31.3125 6.6875 C 32.253906 7.652344 33.695313 8.714844 36.09375 8.9375 C 36.539063 11.238281 38.574219 13 41 13 C 43.75 13 46 10.75 46 8 C 46 5.25 43.75 3 41 3 C 38.605469 3 36.574219 4.710938 36.09375 6.96875 C 34.3125 6.796875 33.527344 6.109375 32.75 5.3125 C 32.300781 4.851563 31.886719
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLIGHT_DRIVER = apa102</span></span></code></pre></div><p>At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your <code>config.h</code>. For APA102 LEDs, you must also define the clock pin. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won&#39;t need to modify these.</p><table><thead><tr><th>Define</th><th>Description</th></tr></thead><tbody><tr><td><code>WS2812_DI_PIN</code></td><td>The pin connected to the data pin of the LEDs (WS2812)</td></tr><tr><td><code>APA102_DI_PIN</code></td><td>The pin connected to the data pin of the LEDs (APA102)</td></tr><tr><td><code>APA102_CI_PIN</code></td><td>The pin connected to the clock pin of the LEDs (APA102)</td></tr><tr><td><code>RGBLIGHT_LED_COUNT</code></td><td>The number of LEDs connected</td></tr><tr><td><code>RGBLED_SPLIT</code></td><td>(Optional) For split keyboards, the number of LEDs connected on each half</td></tr></tbody></table><p>Then you should be able to use the keycodes below to change the RGB lighting to your liking.</p><h3 id="color-selection" tabindex="-1">Color Selection <a class="header-anchor" href="#color-selection" aria-label="Permalink to &quot;Color Selection&quot;"></a></h3><p>QMK uses <a href="https://en.wikipedia.org/wiki/HSL_and_HSV" target="_blank" rel="noreferrer">Hue, Saturation, and Value</a> to select colors rather than RGB. The color wheel below demonstrates how this works.</p><img src="/assets/color-wheel.DWgAL3vL.svg" alt="HSV Color Wheel" width="250"><p>Changing the <strong>Hue</strong> cycles around the circle.<br> Changing the <strong>Saturation</strong> moves between the inner and outer sections of the wheel, affecting the intensity of the color.<br> Changing the <strong>Value</strong> sets the overall brightness.<br></p><p><img src="https://i.imgur.com/vkYVo66.jpg" alt="QMK Color Wheel with HSV Values"></p><h2 id="keycodes" tabindex="-1">Keycodes <a class="header-anchor" href="#keycodes" aria-label="Permalink to &quot;Keycodes&quot;"></a></h2><table><thead><tr><th>Key</th><th>Aliases</th><th>Description</th></tr></thead><tbody><tr><td><code>RGB_TOG</code></td><td></td><td>Toggle RGB lighting on or off</td></tr><tr><td><code>RGB_MODE_FORWARD</code></td><td><code>RGB_MOD</code></td><td>Cycle through modes, reverse direction when Shift is held</td></tr><tr><td><code>RGB_MODE_REVERSE</code></td><td><code>RGB_RMOD</code></td><td>Cycle through modes in reverse, forward direction when Shift is held</td></tr><tr><td><code>RGB_HUI</code></td><td></td><td>Increase hue, decrease hue when Shift is held</td></tr><tr><td><code>RGB_HUD</code></td><td></td><td>Decrease hue, increase hue when Shift is held</td></tr><tr><td><code>RGB_SAI</code></td><td></td><td>Increase saturation, decrease saturation when Shift is held</td></tr><tr><td><code>RGB_SAD</code></td><td></td><td>Decrease saturation, increase saturation when Shift is held</td></tr><tr><td><code>RGB_VAI</code></td><td></td><td>Increase value (brightness), decrease value when Shift is held</td></tr><tr><td><code>RGB_VAD</code></td><td></td><td>Decrease value (brightness), increase value when Shift is held</td></tr><tr><td><code>RGB_MODE_PLAIN</code></td><td><code>RGB_M_P </code></td><td>Static (no animation) mode</td></tr><tr><td><code>RGB_MODE_BREATHE</code></td><td><code>RGB_M_B</code></td><td>Breathing animation mode</td></tr><tr><td><code>RGB_MODE_RAINBOW</code></td><td><code>RGB_M_R</code></td><td>Rainbow animation mode</td></tr><tr><td><code>RGB_MODE_SWIRL</code></td><td><code>RGB_M_SW</code></td><td>Swirl animation mode</td></tr><tr><td><code>RGB_MODE_SNAKE</code></td><td><code>RGB_M_SN</code></td><td>Snake animation mode</td></tr><tr><td><code>RGB_MODE_KNIGHT</code></td><td><code>RGB_M_K</code></td><td>&quot;Knight Rider&quot; animation mode</td></tr><tr><td><code>RGB_MODE_XMAS</code></td><td><code>RGB_M_X</code></td><td>Christmas animation mode</td></tr><tr><td><code>RGB_MODE_GRADIENT</code></td><td><c
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">+#undef RGBLIGHT_EFFECT_STATIC_GRADIENT</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">+#undef RGBLIGHT_EFFECT_RAINBOW_SWIRL</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> #define RGBLIGHT_LED_COUNT 12</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> #define RGBLIGHT_HUE_STEP 8</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> #define RGBLIGHT_SAT_STEP 8</span></span></code></pre></div><h3 id="animation-speed" tabindex="-1">Animation Speed <a class="header-anchor" href="#animation-speed" aria-label="Permalink to &quot;Animation Speed&quot;"></a></h3><p>You can also modify the speeds that the different modes animate at:</p><p>Here is a quick demo on Youtube (with NPKC KC60) (<a href="https://www.youtube.com/watch?v=VKrpPAHlisY" target="_blank" rel="noreferrer">https://www.youtube.com/watch?v=VKrpPAHlisY</a>).</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Solid color breathing&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_BREATHING_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">30</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">20</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Cycling rainbow&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_RAINBOW_MOOD_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">120</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">60</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">30</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Swirling rainbow&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_RAINBOW_SWIRL_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">100</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">20</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Snake&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_SNAKE_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">100</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">20</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Knight&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_KNIGHT_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">127</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">63</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">31</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// How long (in milliseconds) to wait between animation steps for each of the &quot;Twinkle&quot; animations</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_TWINKLE_INTERVALS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">25</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// These control which hues are selected for each of the &quot;Static gradient&quot; modes</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLED_GRADIENT_RANGES</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">255</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">170</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">127</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">85</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">64</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span></code></pre></div><h2 id="lighting-layers" tabindex="-1">Lighting Layers <a class="header-anchor" href="#lighting-layers" aria-label="Permalink to &quot;Lighting Layers&quot;"></a></h2><div class="tip custom-block"><p class="custom-block-title">TIP</p><p><strong>Note:</strong> Lighting Layers is an RGB Light feature, it will not work for RGB Matrix. See <a href="./rgb_matrix#indicators">RGB Matrix Indicators</a> for details on how to do so.</p></div><p>By including <code>#define RGBLIGHT_LAYERS</code> in your <code>config.h</code> file you can enable lighting layers. These make it easy to use your underglow LEDs as status indicators to show which keyboard layer is currently active, or the state of caps lock, all without disrupting any animations. <a href="https://youtu.be/uLGE1epbmdY" target="_blank" rel="noreferrer">Here&#39;s a video</a> showing an example of what you can do.</p><h3 id="defining-lighting-layers" tabindex="-1">Defining Lighting Layers <a class="header-anchor" href="#defining-lighting-layers" aria-label="Permalink to &quot;Defining Lighting Layers {#defining-lighting-layers}&quot;"></a></h3><p>By default, 8 layers are possible. This can be expanded to as many as 32 by overriding the definition of <code>RGBLIGHT_MAX_LAYERS</code> in <code>config.h</code> (e.g. <code>#define RGBLIGHT_MAX_LAYERS 32</code>). Please note, if you use a split keyboard, you will need to flash both sides of the split after changing this. Also, increasing the maximum will increase the firmware size, and will slow sync on split keyboards.</p><p>To define a layer, we modify <code>keymap.c</code> to list the LED ranges and the colors we want to overlay on them using an array of <code>rgblight_segment_t</code> using the <code>RGBLIGHT_LAYER_SEGMENTS</code> macro. We can define multiple layers and enable/disable them independently:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore!</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM my_capslock_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_RED},</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Light 4 LEDs, starting with LED 6</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">12</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_RED}</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Light 4 LEDs, starting with LED 12</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Light LEDs 9 &amp; 10 in cyan when keyboard layer 1 is active</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM my_layer1_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">9</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_CYAN}</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Light LEDs 11 &amp; 12 in purple when keyboard layer 2 is active</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM my_layer2_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">11</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_PURPLE}</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Light LEDs 13 &amp; 14 in green when keyboard layer 3 is active</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM my_layer3_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">13</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_GREEN}</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// etc..</span></span></code></pre></div><p>We combine these layers into an array using the <code>RGBLIGHT_LAYERS_LIST</code> macro, and assign it to the <code>rgblight_layers</code> variable during keyboard setup. Note that you can only define up to 8 lighting layers. Any extra layers will be ignored. Since the different lighting layers overlap, the order matters in the array, with later layers taking precedence:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Now define the array of layers. Later layers take precedence</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM my_rgb_layers</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYERS_LIST</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> my_capslock_layer,</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> my_layer1_layer,</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Overrides caps lock layer</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> my_layer2_layer,</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Overrides other layers</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> my_layer3_layer</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Overrides other layers</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> keyboard_post_init_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Enable the LED layers</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> rgblight_layers </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> my_rgb_layers;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>Note: For split keyboards with two controllers, both sides need to be flashed when updating the contents of rgblight_layers.</p><h3 id="enabling-lighting-layers" tabindex="-1">Enabling and disabling lighting layers <a class="header-anchor" href="#enabling-lighting-layers" aria-label="Permalink to &quot;Enabling and disabling lighting layers {#enabling-lighting-layers}&quot;"></a></h3><p>Everything above just configured the definition of each lighting layer. We can now enable and disable the lighting layers whenever the state of the keyboard changes:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> led_update_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">led_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> led_state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_set_layer_state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, led_state.caps_lock);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">layer_state_t</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> default_layer_state_set_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">layer_state_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_set_layer_state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">layer_state_cmp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(state, _DVORAK));</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> state;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">layer_state_t</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> layer_state_set_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">layer_state_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_set_layer_state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">layer_state_cmp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(state, _FN));</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_set_layer_state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">layer_state_cmp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(state, _ADJUST));</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> state;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="lighting-layer-blink" tabindex="-1">Lighting layer blink <a class="header-anchor" href="#lighting-layer-blink" aria-label="Permalink to &quot;Lighting layer blink {#lighting-layer-blink}&quot;"></a></h3><p>By including <code>#define RGBLIGHT_LAYER_BLINK</code> in your <code>config.h</code> file you can turn a lighting layer on for a specified duration. Once the specified number of milliseconds has elapsed the layer will be turned off. This is useful, e.g., if you want to acknowledge some action (e.g. toggling some setting):</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM _yes_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">( {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">9</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_GREEN} );</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM _no_layer</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYER_SEGMENTS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">( {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">9</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, HSV_RED} );</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rgblight_segment_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM _rgb_layers</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LAYERS_LIST</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">( _yes_layer, _no_layer );</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> keyboard_post_init_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> rgblight_layers </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _rgb_layers;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Note we user post_process_record_user because we want the state</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// after the flag has been flipped...</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> post_process_record_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">uint16_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> keycode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">keyrecord_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> *</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">record</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> switch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (keycode) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> QK_DEBUG_TOGGLE:</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_blink_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(debug_enable </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">500</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> NK_TOGG:</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> NK_ON:</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> NK_OFF:</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_blink_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(keymap_config.nkro </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">500</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>You can also use <code>rgblight_blink_layer_repeat</code> to specify the amount of times the layer is supposed to blink. Using the layers from above,</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> post_process_record_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">uint16_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> keycode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">keyrecord_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> *</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">record</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> switch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (keycode) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> QK_DEBUG_TOGGLE:</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> rgblight_blink_layer_repeat</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(debug_enable </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">200</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>would turn the layer 0 (or 1) on and off again three times when <code>DB_TOGG</code> is pressed.</p><p>Blinking accumulates layers so if multiple layers are set blinking at the same time they will all blink for the duration and repeat times of the last layer to be blinked. To stop these other layers from blinking use <code>rgblight_unblink_layer</code> or <code>rgblight_unblink_all_but_layer</code>:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_blink_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">500</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_unblink_all_but_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_unblink_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_blink_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">500</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>Lighting layers on split keyboards will require layer state synced to the slave half (e.g. <code>#define SPLIT_LAYER_STATE_ENABLE</code>). See <a href="./split_keyboard#data-sync-options">data sync options</a> for more details.</p></div><h3 id="overriding-rgb-lighting-on-off-status" tabindex="-1">Overriding RGB Lighting on/off status <a class="header-anchor" href="#overriding-rgb-lighting-on-off-status" aria-label="Permalink to &quot;Overriding RGB Lighting on/off status&quot;"></a></h3><p>Normally lighting layers are not shown when RGB Lighting is disabled (e.g. with <code>RGB_TOG</code> keycode). If you would like lighting layers to work even when the RGB Lighting is otherwise off, add <code>#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF</code> to your <code>config.h</code>.</p><h3 id="retain-brightness" tabindex="-1">Retain brightness <a class="header-anchor" href="#retain-brightness" aria-label="Permalink to &quot;Retain brightness&quot;"></a></h3><p>Usually lighting layers apply their configured brightness once activated. If you would like lighting layers to retain the currently used brightness (as returned by <code>rgblight_get_val()</code>), add <code>#define RGBLIGHT_LAYERS_RETAIN_VAL</code> to your <code>config.h</code>.</p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><p>If you need to change your RGB lighting in code, for example in a macro to change the color whenever you switch layers, QMK provides a set of functions to assist you. See <a href="https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight/rgblight.h" target="_blank" rel="noreferrer"><code>rgblight.h</code></a> for the full list, but the most commonly used functions include:</p><h3 id="low-level-functions" tabindex="-1">Low level Functions <a class="header-anchor" href="#low-level-functions" aria-label="Permalink to &quot;Low level Functions&quot;"></a></h3><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_set()</code></td><td>Flush out led buffers to LEDs</td></tr><tr><td><code>rgblight_set_clipping_range(pos, num)</code></td><td>Set clipping Range. see <a href="#clipping-range">Clipping Range</a></td></tr></tbody></table><h3 id="effects-and-animations-functions" tabindex="-1">Effects and Animations Functions <a class="header-anchor" href="#effects-and-animations-functions" aria-label="Permalink to &quot;Effects and Animations Functions&quot;"></a></h3><h4 id="effect-range-setting" tabindex="-1">effect range setting <a class="header-anchor" href="#effect-range-setting" aria-label="Permalink to &quot;effect range setting&quot;"></a></h4><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_set_effect_range(pos, num)</code></td><td>Set Effects Range</td></tr></tbody></table><h4 id="direct-operation" tabindex="-1">direct operation <a class="header-anchor" href="#direct-operation" aria-label="Permalink to &quot;direct operation&quot;"></a></h4><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_setrgb_at(r, g, b, index)</code></td><td>Set a single LED to the given RGB value, where <code>r</code>/<code>g</code>/<code>b</code> are between 0 and 255 and <code>index</code> is between 0 and <code>RGBLIGHT_LED_COUNT</code> (not written to EEPROM)</td></tr><tr><td><code>rgblight_sethsv_at(h, s, v, index)</code></td><td>Set a single LED to the given HSV value, where <code>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_sethsv_at</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(HSV_RED, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // led 1</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_sethsv_at</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(HSV_GREEN, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // led 2</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// The above functions automatically calls rgblight_set(), so there is no need to call it explicitly.</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Note that it is inefficient to call repeatedly.</span></span></code></pre></div><h4 id="effect-mode-change" tabindex="-1">effect mode change <a class="header-anchor" href="#effect-mode-change" aria-label="Permalink to &quot;effect mode change&quot;"></a></h4><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_mode(x)</code></td><td>Set the mode, if RGB animations are enabled</td></tr><tr><td><code>rgblight_mode_noeeprom(x)</code></td><td>Set the mode, if RGB animations are enabled (not written to EEPROM)</td></tr><tr><td><code>rgblight_step()</code></td><td>Change the mode to the next RGB animation in the list of enabled RGB animations</td></tr><tr><td><code>rgblight_step_noeeprom()</code></td><td>Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM)</td></tr><tr><td><code>rgblight_step_reverse()</code></td><td>Change the mode to the previous RGB animation in the list of enabled RGB animations</td></tr><tr><td><code>rgblight_step_reverse_noeeprom()</code></td><td>Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM)</td></tr><tr><td><code>rgblight_reload_from_eeprom()</code></td><td>Reload the effect configuration (enabled, mode and color) from EEPROM</td></tr></tbody></table><h4 id="effects-mode-disable-enable" tabindex="-1">effects mode disable/enable <a class="header-anchor" href="#effects-mode-disable-enable" aria-label="Permalink to &quot;effects mode disable/enable&quot;"></a></h4><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_toggle()</code></td><td>Toggle effect range LEDs between on and off</td></tr><tr><td><code>rgblight_toggle_noeeprom()</code></td><td>Toggle effect range LEDs between on and off (not written to EEPROM)</td></tr><tr><td><code>rgblight_enable()</code></td><td>Turn effect range LEDs on, based on their previous state</td></tr><tr><td><code>rgblight_enable_noeeprom()</code></td><td>Turn effect range LEDs on, based on their previous state (not written to EEPROM)</td></tr><tr><td><code>rgblight_disable()</code></td><td>Turn effect range LEDs off</td></tr><tr><td><code>rgblight_disable_noeeprom()</code></td><td>Turn effect range LEDs off (not written to EEPROM)</td></tr></tbody></table><h4 id="hue-sat-val-change" tabindex="-1">hue, sat, val change <a class="header-anchor" href="#hue-sat-val-change" aria-label="Permalink to &quot;hue, sat, val change&quot;"></a></h4><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rgblight_increase_hue()</code></td><td>Increase the hue for effect range LEDs. This wraps around at maximum hue</td></tr><tr><td><code>rgblight_increase_hue_noeeprom()</code></td><td>Increase the hue for effect range LEDs. This wraps around at maximum hue (not written to EEPROM)</td></tr><tr><td><code>rgblight_decrease_hue()</code></td><td>Decrease the hue for effect range LEDs. This wraps around at minimum hue</td></tr><tr><td><code>rgblight_decrease_hue_noeeprom()</code></td><td>Decrease the hue for effect range LEDs. This wraps around at minimum hue (not written to EEPROM)</td></tr><tr><td><code>rgblight_increase_sat()</code></td><td>Increase the saturation for effect range LEDs. This stops at maximum saturation</td></tr><tr><td><code>rgblight_increase_sat_noeeprom()</code></td><td>Increase the saturation for effect range LEDs. This stops at maximum saturation (not written to EEPROM)</td></tr><tr><td><code>rgblight_decrease_sat()</code></td><td>Decrease the saturation for effect range LEDs. This stops at minimum saturation</td></tr><tr><td><code>rgblight_decrease_sat_noeeprom()</code></td><td>Decrease the saturation for effect range LEDs. This stops at minimum saturation (not written to EEPROM)</td></tr><tr><td><code>rgblight_increase_val()</code></td><td>Increase the value for effect range LEDs. This stops at maximum value</td></tr><tr><td><code>rgblight_increase_
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_sethsv_noeeprom</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(HSV_GREEN);</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_setrgb_at</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(RGB_GOLD, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_sethsv_range</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(HSV_WHITE, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><p>These are defined in <a href="https://github.com/qmk/qmk_firmware/blob/master/quantum/color.h" target="_blank" rel="noreferrer"><code>color.h</code></a>. Feel free to add to this list!</p><h2 id="changing-the-order-of-the-leds" tabindex="-1">Changing the order of the LEDs <a class="header-anchor" href="#changing-the-order-of-the-leds" aria-label="Permalink to &quot;Changing the order of the LEDs&quot;"></a></h2><p>If you want to make the logical order of LEDs different from the electrical connection order, you can do this by defining the <code>RGBLIGHT_LED_MAP</code> macro in your <code>config.h</code>.</p><p>Normally, the contents of the LED buffer are output to the LEDs in the same order. <img src="https://user-images.githubusercontent.com/2170248/55743718-01866c80-5a6e-11e9-8134-25419928327a.JPG" alt="simple dicrect" width="50%"></p><p>By defining <code>RGBLIGHT_LED_MAP</code> as in the example below, you can specify the LED with addressing in reverse order of the electrical connection order.</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// config.h</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LED_COUNT</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 4</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LED_MAP</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span></code></pre></div><img src="https://user-images.githubusercontent.com/2170248/55743725-08ad7a80-5a6e-11e9-83ed-126a2b0209fc.JPG" alt="simple mapped" width="50%"><h2 id="clipping-range" tabindex="-1">Clipping Range <a class="header-anchor" href="#clipping-range" aria-label="Permalink to &quot;Clipping Range&quot;"></a></h2><p>Using the <code>rgblight_set_clipping_range()</code> function, you can prepare more buffers than the actual number of LEDs, and output some of the buffers to the LEDs. This is useful if you want the split keyboard to treat left and right LEDs as logically contiguous.</p><p>You can set the Clipping Range by executing the following code.</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// some source</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_set_clipping_range</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><img src="https://user-images.githubusercontent.com/2170248/55743785-2bd82a00-5a6e-11e9-9d4b-1b4ffaf4932b.JPG" alt="clip direct" width="70%"><p>In addition to setting the Clipping Range, you can use <code>RGBLIGHT_LED_MAP</code> together.</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// config.h</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LED_COUNT</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 8</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LED_MAP</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">7</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// some source</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">rgblight_set_clipping_range</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><img src="https://user-images.githubusercontent.com/2170248/55743747-119e4c00-5a6e-11e9-91e5-013203ffae8a.JPG" alt="clip mapped" width="70%"><h2 id="hardware-modification" tabindex="-1">Hardware Modification <a class="header-anchor" href="#hardware-modification" aria-label="Permalink to &quot;Hardware Modification&quot;"></a></h2><p>If your keyboard lacks onboard underglow LEDs, you may often be able to solder on an RGB LED strip yourself. You will need to find an unused pin to wire to the data pin of your LED strip. Some keyboards may break out unused pins from the MCU to make soldering easier. The other two pins, VCC and GND, must also be connected to the appropriate power pins.</p><h2 id="velocikey" tabindex="-1">Velocikey <a class="header-anchor" href="#velocikey" aria-label="Permalink to &quot;Velocikey&quot;"></a></h2><p>Velocikey is a feature that lets you control the speed of lighting effects (like the Rainbow Swirl effect) with the speed of your typing. The faster you type, the faster the lights will go!</p><h3 id="usage-1" tabindex="-1">Usage <a class="header-anchor" href="#usage-1" aria-label="Permalink to &quot;Usage&quot;"></a></h3><p>For Velocikey to take effect, there are two steps. First, when compiling your keyboard, you&#39;ll need to set <code>VELOCIKEY_ENABLE=yes</code> in <code>rules.mk</code>, e.g.:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>MOUSEKEY_ENABLE = no</span></span>
<span class="line"><span>STENO_ENABLE = no</span></span>
<span class="line"><span>EXTRAKEY_ENABLE = yes</span></span>
<span class="line"><span>VELOCIKEY_ENABLE = yes</span></span></code></pre></div><p>Then, while using your keyboard, you need to also turn it on with the <code>VK_TOGG</code> keycode, which toggles the feature on and off.</p><p>The following light effects will all be controlled by Velocikey when it is enabled:</p><ul><li>RGB Breathing</li><li>RGB Rainbow Mood</li><li>RGB Rainbow Swirl</li><li>RGB Snake</li><li>RGB Knight</li></ul><p>Support for LED breathing effects is planned but not available yet.</p><p>As long as Velocikey is enabled, it will control the speed regardless of any other speed setting that your RGB lights are currently on.</p><h3 id="configuration-1" tabindex="-1">Configuration <a class="header-anchor" href="#configuration-1" aria-label="Permalink to &quot;Configuration&quot;"></a></h3><p>Velocikey doesn&#39;t currently support any configuration via keyboard settings. If you want to adjust something like the speed increase or decay rate, you would need to edit <code>velocikey.c</code> and adjust the values there to achieve the kinds of speeds that you like.</p></div></div></main><footer class="VPDocFooter" data-v-39a288b8 data-v-09de1c0f><!--[--><!--]--><!----><nav class="prev-next" data-v-09de1c0f><div class="pager" data-v-09de1c0f><a class="VPLink link pager-link prev" href="/features/led_matrix" data-v-09de1c0f><!--[--><span class="desc" data-v-09de1c0f>Previous page</span><span class="title" data-v-09de1c0f>LED Matrix</span><!--]--></a></div><div class="pager" data-v-09de1c0f><a class="VPLink link pager-link next" href="/features/rgb_matrix" data-v-09de1c0f><!--[--><span class="desc" data-v-09de1c0f>Next page</span><span class="title" data-v-09de1c0f>RGB Matrix</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"changelog_20210529.md\":\"CR1YNfZX\",\"changelog_20190830.md\":\"Drtq3lMy\",\"changelog_20210227.md\":\"BWOtCaeS\",\"changelog_20220528.md\":\"BX3CCY1Z\",\"changelog_20201128.md\":\"7XXL02Bn\",\"changelog_20220226.md\":\"BWO5r_ec\",\"changelog_20200530.md\":\"Dk-vRpTQ\",\"changelog_20210828.md\":\"DNbHIuuM\",\"changelog_20211127.md\":\"ClUawWkq\",\"drivers_i2c.md\":\"Cuj87reB\",\"faq_misc.md\":\"qGrhOTu4\",\"cli_commands.md\":\"DGx-qNiE\",\"drivers_uart.md\":\"BNBs-m3h\",\"feature_advanced_keycodes.md\":\"CX8dJkY-\",\"api_overview.md\":\"0FPaUsMb\",\"arm_debugging.md\":\"BH-H2Ukz\",\"feature_layers.md\":\"8GwBUTZN\",\"features_mouse_keys.md\":\"C3P3pYuE\",\"features_oled_driver.md\":\"D9wJVdL1\",\"changelog_20200829.md\":\"CoqrOffn\",\"breaking_changes_instructions.md\":\"BAjIGeJb\",\"changelog_20230226.md\":\"Cg0AYxIn\",\"changelog_20240526.md\":\"iGLFD0SP\",\"changelog_20200229.md\":\"DNsowwM1\",\"breaking_changes_history.md\":\"CkzdD6x8\",\"changelog_20220827.md\":\"DjPthqDk\",\"cli.md\":\"BLzAdA6l\",\"platformdev_blackpill_f4x1.md\":\"DvObLRuk\",\"platformdev_proton_c.md\":\"CDRuJBvD\",\"squeezing_avr.md\":\"BmcLYKOr\",\"platformdev_rp2040.md\":\"CYKYMDfc\",\"cli_tab_complete.md\":\"ChaxfzYo\",\"platformdev_selecting_arm_mcu.md\":\"aF4DUsvb\",\"data_driven_config.md\":\"BvLQ7P20\",\"porting_your_keyboard_to_qmk.md\":\"CGlGdFj4\",\"other_eclipse.md\":\"C-zqyJO9\",\"features_rgb_matrix.md\":\"8PRlkGEq\",\"syllabus.md\":\"B_ARGkLg\",\"quantum_painter_rle.md\":\"B07V3m-n\",\"features_hd44780.md\":\"15K40o_e\",\"one_shot_keys.md\":\"QR09rSb-\",\"unit_testing.md\":\"u3fgbGUj\",\"features_secure.md\":\"BX7jFvW5\",\"features_rgblight.md\":\"DehQikiL\",\"features_send_string.md\":\"vM68un4v\",\"ref_functions.md\":\"BVI2uXSN\",\"flashing_bootloadhid.md\":\"aXGP0bN5\",\"getting_started_docker.md\":\"mz6HE4Bl\",\"getting_started_github.md\":\"OYq7IT7B\",\"getting_started_introduction.md\":\"BOJreqSs\",\"tap_hold.md\":\"DD8WTSla\",\"getting_started_make_guide.md\":\"BjUuEnSh\",\"hand_wire.md\":\"CcI1spCv\",\"understanding_qmk.md\":\"f-Bc_eHQ\",\"hardware_drivers.md\":\"BUnx48D9\",\"flashing.md\":\"BSZF2RCy\",\"index.md\":\"B4QYzvHE\",\"keycodes_magic.md\":\"CGO3hgMm\",\"hardware_keyboard_guidelines.md\":\"CJevsanE\",\"keycodes_basic.md\":\"CHIeCvwn\",\"keycodes_us_ansi_shifted.md\":\"Cs78SDfM\",\"reference_configurator_support.md\":\"FaBQzIj6\",\"mod_tap.md\":\"C7wRKLcf\",\"newbs.md\":\"-YYNd3dT\",\"api_development_overview.md\":\"Dcey4ntL\",\"capabilities_inc.md\":\"Ca9zpMce\",\"newbs_building_firmware.md\":\"DnVUK9it\",\"api_development_environment.md\":\"EhJClb9f\",\"keymap.md\":\"Y4Fei1Ty\",\"isp_flashing_guide.md\":\"BiuBpOKX\",\"newbs_building_firmware_workflow.md\":\"DpLVwA7x\",\"cli_development.md\":\"3xFA2OvS\",\"changelog_20231126.md\":\"D2Ok5QAf\",\"cli_configuration.md\":\"CGSB128P\",\"newbs_external_userspace.md\":\"pD9Lc-a5\",\"newbs_flashing.md\":\"B42m5Wln\",\"how_keyboards_work.md\":\"CB7z8ocb\",\"newbs_getting_started.md\":\"DD4a5qPC\",\"other_vscode.md\":\"Di3vOySR\",\"keycodes.md\":\"hkOkKJPh\",\"newbs_git_using_your_master_branch.md\":\"B9DxZCl8\",\"quantum_painter_lvgl.md\":\"DobNbSgA\",\"documentation_templates.md\":\"Bhkum0wD\",\"api_docs.md\":\"CRoD6CbL\",\"support.md\":\"CwJ_H6Qx\",\"driver_installation_zadig.md\":\"CX9-BACt\",\"changelog_20221126.md\":\"DpbrnXeC\",\"newbs_building_firmware_configurator.md\":\"yyo-1QDE\",\"newbs_learn_more_resources.md\":\"Dj1s2BDG\",\"breaking_changes.md\":\"BtdqWQlY\",\"drivers_serial.md\":\"qxjytVdM\",\"quantum_painter_qgf.md\":\"BJNSu2s0\",\"newbs_git_best_practices.md\":\"BI2-EVI5\",\"newbs_git_resolving_merge_conflicts.md\":\"72w3BRmm\",\"newbs_git_resynchronize_a_branch.md\":\"YGDefQFx\",\"drivers_apa102.md\":\"Qb-KXRpF\",\"reference_keymap_extras.md\":\"-n_bLm78\",\"features_wpm.md\":\"BYf-Xc1H\",\"drivers_gpio.md\":\"C5PvyJVh\",\"drivers_audio.md\":\"mqaz6p5N\",\"drivers_spi.md\":\"tJVeIT7e\",\"changelog_20240225.md\":\"B4-WrXj6\",\"features_sequencer.md\":\"DkgqNCsQ\",\"drivers_flash.md\":\"DhWcHp8S\",\"feature
</body>
</html>