Add per-key RGB layer support via darknao's fork

Switch ZMK source to afiqzudinhadi/zmk@rgb-layer (v0.3.0 base +
darknao's per-key RGB patches, all original authors preserved).

- Enable CONFIG_EXPERIMENTAL_RGB_LAYER in corne.conf
- Add underglow-layer node with per-layer color maps:
  CARP=teal, QWRT=blue, STEN=red, FPS=green/orange, HUB=functional
- pixel-lookup assumes left-half serpentine wiring (right half TBD)
- HUB layer uses fade-delay for smooth transitions
This commit is contained in:
afiqzudinhadi 2026-06-24 19:31:56 +08:00
parent ae07b10792
commit a01b4cae8f
3 changed files with 108 additions and 10 deletions

View file

@ -79,6 +79,9 @@ CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=1
CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=n
### PER-KEY RGB LAYER (darknao fork)
CONFIG_EXPERIMENTAL_RGB_LAYER=y
# CONFIG_ZMK_RGB_UNDERGLOW_HUE_STEP=30
# CONFIG_ZMK_RGB_UNDERGLOW_SAT_STEP=2
# CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=240

View file

@ -13,10 +13,7 @@
#include <dt-bindings/zmk/backlight.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/reset.h>
&led_strip {
chain-length = <27>;
};
#include <dt-bindings/zmk/rgb_colors.h>
/ {
behaviors {
@ -67,6 +64,103 @@
combo_tab { key-positions = <14 15>; bindings = <&kp TAB>; layers = <0 1>; };
};
/*
* Per-key RGB layer colors (darknao fork).
*
* pixel-lookup maps LED chain index key position.
* Current mapping assumes left-half serpentine wiring:
* underglow(6) row0(LR) row1(RL) row2(LR) thumbs(RL)
* Right half will mirror left colors until per-half overlays are added.
* Adjust pixel-lookup if LEDs map to wrong keys on your PCB.
*
* Key positions:
* 0 1 2 3 4 5 | 6 7 8 9 10 11
* 12 13 14 15 16 17 | 18 19 20 21 22 23
* 24 25 26 27 28 29 | 30 31 32 33 34 35
* 36 37 38 | 39 40 41
*/
underglow-layer {
compatible = "zmk,underglow-layer";
pixel-lookup = <
255 255 255 255 255 255
0 1 2 3 4 5
17 16 15 14 13 12
24 25 26 27 28 29
38 37 36
>;
carp_rgb {
layer-id = <0>;
bindings = <
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
};
qwrt_rgb {
layer-id = <1>;
bindings = <
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
};
sten_rgb {
layer-id = <2>;
bindings = <
&ug ___ &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug WHITE
&ug WHITE &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug RED
&ug ___ &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug RED
&ug ___ &ug RED &ug RED
&ug RED &ug RED &ug ___
>;
};
fps_rgb {
layer-id = <3>;
bindings = <
&ug ORANGE &ug ORANGE &ug BLUE &ug GREEN &ug BLUE &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug WHITE
&ug BLUE &ug ORANGE &ug GREEN &ug GREEN &ug GREEN &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug ___
&ug ORANGE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug ___
&ug BLUE &ug ORANGE &ug GREEN
&ug ___ &ug ___ &ug ___
>;
};
hub_rgb {
layer-id = <4>;
bindings = <
&ug RED &ug PURPLE &ug PURPLE &ug PURPLE &ug PURPLE &ug PURPLE
&ug BLUE &ug YELLOW &ug YELLOW &ug YELLOW &ug BLUE &ug BLUE
&ug ORANGE &ug ORANGE &ug ORANGE &ug ORANGE &ug TEAL &ug TEAL
&ug BLUE &ug YELLOW &ug YELLOW &ug YELLOW &ug BLUE &ug BLUE
&ug WHITE &ug ORANGE &ug ORANGE &ug ORANGE &ug TEAL &ug TEAL
&ug GREEN &ug GREEN &ug GREEN &ug GREEN &ug GOLD &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
fade-delay = <15>;
};
};
keymap {
compatible = "zmk,keymap";

View file

@ -2,6 +2,9 @@ manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
# ZMK fork with per-key RGB layer support (darknao's patches on v0.3.0)
- name: afiqzudinhadi-zmk
url-base: https://github.com/afiqzudinhadi
# dongle_display
- name: englmaxi
url-base: https://github.com/englmaxi
@ -12,13 +15,11 @@ manifest:
- name: KeebMaker
url-base: https://github.com/KeebMaker
projects:
# Pinned to v0.3.0 instead of `main`: ZMK main tracks Zephyr 4.1, whose
# board-model rewrite renamed `nice_nano_v2` (now `nice_nano//zmk`) and
# split the `WS2812_STRIP` Kconfig symbol per-driver. Bumping this back to
# `main` will break every build.yaml entry below until those are updated.
# Personal fork of ZMK v0.3.0 + darknao's per-key RGB layer patches.
# Base is v0.3.0 (not main) — see commit history for patch attribution.
- name: zmk
remote: zmkfirmware
revision: v0.3.0
remote: afiqzudinhadi-zmk
revision: rgb-layer
import: app/west.yml
# dongle_display
- name: zmk-dongle-display