Hint

Refer to QMK’s documentation for details on how to use community modules

ledmap

Define a static, per-key, RGB matrix design.

It works similar to keymaps, mapping a color to each key and allowing transparency.

Hackery is needed (re-defining XXX) so that LAYOUT can correctly fill un-used matrix spots with values of type color_t. See example:

#include "elpekenin/ledmap.h"

// short aliases
#define BLACK RGB_COLOR(RGB_BLACK)
#define CYAN HUE_COLOR(HUE_CYAN)
#define RED HSV_COLOR(HSV_RED)
#define TRNS TRNS_COLOR
#define WHITE WHITE_COLOR

// make LAYOUT work
#undef XXX
#define XXX NONE_COLOR

const color_t PROGMEM ledmap[][MATRIX_ROWS][MATRIX_COLS] = {
    [QWERTY] = LAYOUT(
        RED,  RED,  RED,  RED,  RED,  RED,     RED,  RED,  RED,  RED,  RED,  RED,
        RED,  RED,  RED,  RED,  RED,  RED,     RED,  RED,  RED,  RED,  RED,  RED,
        RED,  RED,  RED,  RED,  RED,  RED,     RED,  RED,  RED,  RED,  RED,  RED,
        RED,  RED,  RED,  RED,  RED,  RED,     RED,  RED,  RED,  RED,  RED,  RED,
        RED,  RED,  RED,  RED,    BLACK,         WHITE,    RED,  TRNS, RED,  RED
    ),
    [FN] = LAYOUT(
        TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
        CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,    CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,
        CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,    CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,
        CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,    CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,
        WHITE,WHITE,BLACK,TRNS,    BLACK,         BLACK,   RED,  TRNS, WHITE,WHITE
    ),
 };

Warning

Due to reusing LAYOUT macro to define the colors, implementation is not too flexible.
  • Assumes existence of a LED under every key.

  • Does not support assigning colors to LEDs that aren’t under a key (eg: indicators or underglow)

It also hasn’t been exhaustively tested, there might be some problems.