# Per Layer RGB control

**URL:** <https://community.frame.work/t/per-layer-rgb-control/84982>\
**Category:** Framework Laptop 16\
**Tags:** framework-laptop-16-amd-7040, project, graphics-module-amd-rx7700s, feature-requests\
**Created:** [September 21, 2026, 5:11pm UTC](https://community.frame.work/t/per-layer-rgb-control/84982 "2026-09-21T17:11:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guest478](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@Guest478](https://community.frame.work/u/Guest478)\
**Post date:** [September 21, 2026, 5:11pm UTC](https://community.frame.work/t/per-layer-rgb-control/84982/1 "2026-09-21T17:11:46Z")

</div>

Hi everyone,

_this is my first post here and i’m not sure if this is the right category, but this is what seemed right to me.  
Also, English is not my first language, so please forgive me all my mistakes_ 😉

I finally came around to configure the Macropad of my Framework 16 which was not as straight-forward as I imagined it to be as I had to manually edit my udev-rules.

But now, that I have multiple Layers of keybindings, I have the issue that I never know on which Layer I currently am.

My preferred solution would be to have different RGB colours or Patterns for each Layer, which would include the following functions:

- the Effect changes when a Layer is changed
- a Layer always has the same Effect
- Keys should have individual Colours to indicate their function (optional)
- I only have to press one key to change Layer and Colour, not multiple

has anyone already achieved something like this?

I already tried to create a marco that does that, but i cant attach a layerchange to a macro.

Also, the Lighting Settings are global and independant of the active layer

Is something like I proposed even possible with standard firmware?

If not:

Could Framework integrate such functionality, as I think this could be beneficial to many users?

I am not a software developer, but I think it wouldn’t be that hard to add an option to configure individual lighting modes per layer.

Thank you!

---

<div class="post-metadata">

**Author:** ![Per\_Magnus\_Tveten](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Per\_Magnus\_Tveten](https://community.frame.work/u/Per_Magnus_Tveten)\
**Post date:** [September 23, 2026, 11:53am UTC](https://community.frame.work/t/per-layer-rgb-control/84982/2 "2026-09-23T11:53:15Z")

</div>

Welcome Guest478 🙂

this is the thread that I used to make my macro pad behave the way I wanted it to 🙂

> [@How to get to point you can have per key RGB control for keyboard and macropad?](https://community.frame.work/t/how-to-get-to-point-you-can-have-per-key-rgb-control-for-keyboard-and-macropad/47080):
>
> i have seen two different posts glossing over this but i need a step by step guide and i feel others do too to set everything up and to change the per key color. i have some knowledge of light coding but trying to follow what was posted or the framework github directory has left me pulling out my hair. I cant figure out what files are even needed from keyboard directory. i just want to make certain keys same color while rest are different depending on the task. i wasnt expecting to have to go d…

if I remember right @MJ1 was the one who had done a lot of work and explained how it works so if this is helpfull then all credits go to him 🙂

but yeah in that thread you can see my super simple keymap.c and yeah it does what I need.. so thats good enough for me for now 🙂

FrameworkDeck was another project someone else doing..  
[https://github.com/enkode/FrameworkDeck](https://github.com/enkode/FrameworkDeck)  
to be honest I can’t remember why I’m not using that one instead of my custom built thing..

as for your english, seems perfectly fine to me 🙂

---

<div class="post-metadata">

**Author:** ![Guest478](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@Guest478](https://community.frame.work/u/Guest478)\
**Post date:** [September 23, 2026, 2:42pm UTC](https://community.frame.work/t/per-layer-rgb-control/84982/3 "2026-09-23T14:42:58Z")

</div>

in that thread, you said that you also wanted to Layers in the Future.

Have you already done that or do you know how I could modify your Keymap to achieve that?

Regarding the FrameworkDeck, I dont trust it as much as it seems to be mainly vibecoded.

So if can i achieve it with your version (+ some modifications), i would prefer that.

---

<div class="post-metadata">

**Author:** ![Per\_Magnus\_Tveten](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Per\_Magnus\_Tveten](https://community.frame.work/u/Per_Magnus_Tveten)\
**Post date:** [September 23, 2026, 10:31pm UTC](https://community.frame.work/t/per-layer-rgb-control/84982/4 "2026-09-23T22:31:47Z")

</div>

Ahh here I was thinking that thread had the latest bit I had done…  
its not perfection by any means or probably even the best way to do things, might even be the worst.. but seems to work 🙂

```auto
#include QMK_KEYBOARD_H
#define MAX_BRIGHTNESS 255
#define MIN_BRIGHTNESS 10

enum custom_keycodes {
    MACRO_BRIGHT_UP = SAFE_RANGE,
    MACRO_BRIGHT_DOWN
};

static uint8_t ledbright = 20; // Start at 20% brightness

bool increasing = true; // Tracks the direction of the color shift
uint8_t green = 255;
uint8_t blue = 0;

/* Macropad key location to LED Index
     * ┌────┬────┬────┬────┐
     * row 1 │ 5 │ 2 │ 22 │ 17 │
     * ├────┼────┼────┼────┤
     * row 2 │ 4 │ 0 │ 20 │ 18 │
     * ├────┼────┼────┼────┤
     * row 3 │ 7 │ 1 │ 21 │ 16 │
     * ├────┼────┼────┼────┤
     * row 4 │ 6 │ 3 │ 23 │ 19 │
     * ├────┼────┼────┼────┤
     * row 5 │ 9 │ 11 │ 15 │ 13 │
     * ├────┼────┼────┼────┤
     * row 6 │ 8 │ 10 │ 14 │ 12 │
     * └────┴────┴────┴────┘
     * 24 keys and LEDs total
     */

     // Hold down 2 and 6 to flash firmware to macro pad

uint8_t led_colors[24][3] = {
     [5] = { 64, 64, 64}, // Shurly this must be grey now.
     [2] = { 64, 64, 64}, // Shurly this must be grey now.
    [22] = { 64, 64, 64}, // light blue
    [17] = { 64, 64, 64}, // DeepDarkBlue
     [7] = {255, 0, 0}, // Red
     [1] = {255, 165, 0}, // Orange (leaning towards yellow)
    [21] = {255, 0, 0}, // Red
    [19] = {128, 128, 32}, // Red
     [6] = {255, 69, 0}, // Orange
     [3] ={234, 255, 0}, // Yellowish with a hint of green
    [23] = {255, 69, 0}, // Orange
    [12] = { 0, 140, 139}, // Teal
     [8] = { 0, 220, 139}, // Teal
     [9] = {140, 0, 139}, // Purpleish
     [4] = {255, 255, 255}, // White
     [0] = {191, 191, 191}, // Dimmer white
    [20] = {128, 128, 128}, // can we call it grey yet ?
    [18] = { 64, 64, 64} // Shurly this must be grey now.

};

// Default color for all other keys (Dark Blue)
#define DEFAULT_R 0
#define DEFAULT_G 0
#define DEFAULT_B 139

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
        KC_NO, KC_NO, KC_NO, KC_NO,
        KC_1, KC_2, KC_3, KC_4,
        KC_Q, KC_W, KC_E, KC_TAB,
        KC_A, KC_S, KC_D, KC_F,
        KC_LSFT, KC_NO, KC_NO, TO(1),
        KC_LCTL, KC_NO, KC_NO, KC_SPACE
    ),
    [1] = LAYOUT(
        KC_NO, KC_NO, KC_NO, KC_NO,
        KC_NO, KC_NO, KC_NO, KC_NO,
         KC_7, KC_8, KC_9, KC_NO,
         KC_4, KC_5, KC_6, KC_NO,
         KC_1, KC_2, KC_3, TO(2),
        KC_NO, KC_0, KC_NO, KC_NO
    ),
    [2] = LAYOUT(
        KC_NO, KC_NO, KC_NO, KC_NO,
        KC_F1, KC_F2, KC_F3, KC_F4,
        KC_Q, KC_W, KC_E, KC_TAB,
        KC_A, KC_S, KC_D, KC_F,
        KC_LSFT, KC_NO, KC_NO, TO(3),
        KC_LCTL, KC_NO, KC_NO, KC_SPACE
    ),
    [3] = LAYOUT(
        KC_NO, KC_NO, KC_NO, KC_NO,
        KC_F1, KC_F2, KC_F3, KC_F4,
        KC_HOME, KC_UP, KC_PGUP, KC_TAB,
        KC_LEFT, KC_DOWN, KC_RIGHT, KC_F,
        KC_LSFT, KC_NO, KC_NO, TO(0),
        KC_LCTL, KC_NO, KC_NO, KC_SPACE
    )
};

void cycle_tab_color(void) {
    if (increasing) {
        green--;
        blue++;
        if (green == 0 && blue == 255) {
            increasing = false; // Reverse direction
        }
    } else {
        green++;
        blue--;
        if (green == 255 && blue == 0) {
            increasing = true; // Switch back
        }
    }
    led_colors[16][0]=0;
    led_colors[16][1]=green;
    led_colors[16][2]=blue;

    //rgb_matrix_set_color(16, 0, green, blue);// Update RGB lighting
}

bool rgb_matrix_indicators_user(void) {
    if (layer_state_is(0)) 
    {
        led_colors[13][0]=0;
        led_colors[13][1]=255;
        led_colors[13][2]=0; 
    }

    if (layer_state_is(1)) 
    {
        led_colors[13][0]=255;
        led_colors[13][1]=0;
        led_colors[13][2]=0; 
    }      

    if (layer_state_is(2)) 
    {
        led_colors[13][0]=0;
        led_colors[13][1]=0;
        led_colors[13][2]=255; 
    }      

    if (layer_state_is(3)) 
    {
        led_colors[13][0]=255;
        led_colors[13][1]=0;
        led_colors[13][2]=255; 
    }      
    
    
    for (int i = 0; i < 24; i++) {
        uint8_t r = DEFAULT_R, g = DEFAULT_G, b = DEFAULT_B;
        
        if (led_colors[i][0] || led_colors[i][1] || led_colors[i][2]) {
            r = (led_colors[i][0] * ledbright) / MAX_BRIGHTNESS;
            g = (led_colors[i][1] * ledbright) / MAX_BRIGHTNESS;
            b = (led_colors[i][2] * ledbright) / MAX_BRIGHTNESS;
        } else {
            r = (DEFAULT_R * ledbright) / MAX_BRIGHTNESS;
            g = (DEFAULT_G * ledbright) / MAX_BRIGHTNESS;
            b = (DEFAULT_B * ledbright) / MAX_BRIGHTNESS;
        }
        rgb_matrix_set_color(i, r, g, b);
    }
    cycle_tab_color();
    return true;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    if (record->event.pressed) {
        if (keycode == MACRO_BRIGHT_DOWN) { 
            if (ledbright > MIN_BRIGHTNESS) {
                ledbright -= 1;
            }
        } else if (keycode == MACRO_BRIGHT_UP) { 
            if (ledbright < MAX_BRIGHTNESS) {
                ledbright += 1;
            }
        }
    }
    return false;
}

```

so here is where I basically just set the colour of one of the keys to indicate the layer i’m on 🙂

```auto
bool rgb_matrix_indicators_user(void) {
    if (layer_state_is(0)) 
    {
        led_colors[13][0]=0;
        led_colors[13][1]=255;
        led_colors[13][2]=0; 
    }

    if (layer_state_is(1)) 
    {
        led_colors[13][0]=255;
        led_colors[13][1]=0;
        led_colors[13][2]=0; 
    }      

    if (layer_state_is(2)) 
    {
        led_colors[13][0]=0;
        led_colors[13][1]=0;
        led_colors[13][2]=255; 
    }      

    if (layer_state_is(3)) 
    {
        led_colors[13][0]=255;
        led_colors[13][1]=0;
        led_colors[13][2]=255; 
    }      
    
    
    for (int i = 0; i < 24; i++) {
        uint8_t r = DEFAULT_R, g = DEFAULT_G, b = DEFAULT_B;
        
        if (led_colors[i][0] || led_colors[i][1] || led_colors[i][2]) {
            r = (led_colors[i][0] * ledbright) / MAX_BRIGHTNESS;
            g = (led_colors[i][1] * ledbright) / MAX_BRIGHTNESS;
            b = (led_colors[i][2] * ledbright) / MAX_BRIGHTNESS;
        } else {
            r = (DEFAULT_R * ledbright) / MAX_BRIGHTNESS;
            g = (DEFAULT_G * ledbright) / MAX_BRIGHTNESS;
            b = (DEFAULT_B * ledbright) / MAX_BRIGHTNESS;
        }
        rgb_matrix_set_color(i, r, g, b);
    }
    cycle_tab_color();
    return true;
}

```

hopefully this helps somewhat.. Colour cycling I was just curious if I could do it and was messing around..

---

<div class="post-metadata">

**Author:** ![Guest478](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@Guest478](https://community.frame.work/u/Guest478)\
**Post date:** [October 5, 2026, 7:06am UTC](https://community.frame.work/t/per-layer-rgb-control/84982/5 "2026-10-05T07:06:33Z")

</div>

Tahnk you very much!

This is the keymap as i modified it, if anyone is interested:

```auto
#include QMK_KEYBOARD_H
#define MAX_BRIGHTNESS 255
#define MIN_BRIGHTNESS 10

enum custom_keycodes {
    MACRO_BRIGHT_UP = SAFE_RANGE,
    MACRO_BRIGHT_DOWN
};

static uint8_t ledbright = 100; // Start at 20% brightness

bool increasing = true; // Tracks the direction of the color shift
uint8_t green = 255;
uint8_t blue = 0;

/* Macropad key location to LED Index
 * ┌────┬────┬────┬────┐
 * row 1 │ 5 │ 2 │ 22 │ 17 │
 * ├────┼────┼────┼────┤
 * row 2 │ 4 │ 0 │ 20 │ 18 │
 * ├────┼────┼────┼────┤
 * row 3 │ 7 │ 1 │ 21 │ 16 │
 * ├────┼────┼────┼────┤
 * row 4 │ 6 │ 3 │ 23 │ 19 │
 * ├────┼────┼────┼────┤
 * row 5 │ 9 │ 11 │ 15 │ 13 │
 * ├────┼────┼────┼────┤
 * row 6 │ 8 │ 10 │ 14 │ 12 │
 * └────┴────┴────┴────┘
 * 24 keys and LEDs total
 */

// Hold down 2 and 6 to flash firmware to macro pad

uint8_t led_colors[24][3] = {

};

// Default color for all other keys (Dark Blue)
#define DEFAULT_R 64
#define DEFAULT_G 64
#define DEFAULT_B 64

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
        KC_ESC, KC_CALC, KC_EQL, KC_NO,
        TO(1), KC_PSLS, KC_PAST, KC_BSPC,
        KC_7, KC_8, KC_9, KC_PMNS,
        KC_4, KC_5, KC_6, KC_PPLS,
        KC_1, KC_2, KC_3, KC_ENT,
        TO(1), KC_0, KC_DOT, KC_ENT

    ),
    [1] = LAYOUT(
        QK_CLEAR_EEPROM, QK_BOOT, MACRO_BRIGHT_UP, MACRO_BRIGHT_DOWN,
        TO(0), KC_NO, KC_NO, BL_STEP,
        KC_NO, KC_UP, KC_PAGE_UP, KC_NO,
        KC_LEFT, KC_ENT, KC_RIGHT, KC_NO,
        KC_NO, KC_DOWN, KC_PAGE_DOWN, KC_NO,
        TO(2), KC_CUT, KC_COPY, KC_PASTE
    ),
    [2] = LAYOUT(
        KC_NO, KC_NO, KC_NO, KC_NO,
        KC_NO, KC_1, KC_2, KC_3,
        KC_TAB, KC_Q, KC_W, KC_E,
        KC_LSFT, KC_A, KC_S, KC_D,
        KC_LSFT, KC_NO, KC_NO, KC_NO,
        TO(0), KC_NO, KC_NO, KC_SPACE
    ),
    [3] = LAYOUT(
        KC_F21, KC_F22, KC_F23, KC_F24,
        KC_F1, KC_F2, KC_F3, KC_F4,
        KC_HOME, KC_UP, KC_PGUP, KC_TAB,
        KC_LEFT, KC_DOWN, KC_RIGHT, KC_F,
        KC_LSFT, KC_NO, KC_NO, TO(0),
        KC_LCTL, KC_NO, KC_NO, KC_SPACE
    )
};
/*
void cycle_tab_color(void) {
    if (increasing) {
        green--;
        blue++;
        if (green == 0 && blue == 255) {
            increasing = false; // Reverse direction
        }
    } else {
        green++;
        blue--;
        if (green == 255 && blue == 0) {
            increasing = true; // Switch back
        }
    }
    led_colors[16][0]=0;
    led_colors[16][1]=green;
    led_colors[16][2]=blue;

    //rgb_matrix_set_color(16, 0, green, blue);// Update RGB lighting
}
*/
#define NUMPAD_R 20
#define NUMPAD_G 60
#define NUMPAD_B 255
bool rgb_matrix_indicators_user(void) {
    if (layer_state_is(0))
    {
        //2nd row
        led_colors[4][0]=0;
        led_colors[4][1]=0;
        led_colors[4][2]=255;
        led_colors[0][0]=200;
        led_colors[0][1]=0;
        led_colors[0][2]=200;
        led_colors[20][0]=150;
        led_colors[20][1]=200;
        led_colors[20][2]=0;
        //right column
        led_colors[18][0]=255;
        led_colors[18][1]=70;
        led_colors[18][2]=0;
        led_colors[16][0]=255;
        led_colors[16][1]=0;
        led_colors[16][2]=0;
        led_colors[19][0]=0;
        led_colors[19][1]=255;
        led_colors[19][2]=0;
        led_colors[13][0]=255;
        led_colors[13][1]=255;
        led_colors[13][2]=255;

        //cross
        led_colors[1][0]=NUMPAD_R;
        led_colors[1][1]=NUMPAD_G;
        led_colors[1][2]=NUMPAD_B;
        led_colors[6][0]=NUMPAD_R;
        led_colors[6][1]=NUMPAD_G;
        led_colors[6][2]=NUMPAD_B;
        led_colors[11][0]=NUMPAD_R;
        led_colors[11][1]=NUMPAD_G;
        led_colors[11][2]=NUMPAD_B;
        led_colors[23][0]=NUMPAD_R;
        led_colors[23][1]=NUMPAD_G;
        led_colors[23][2]=NUMPAD_B;
        //center
        led_colors[3][0]=NUMPAD_R;
        led_colors[3][1]=NUMPAD_G;
        led_colors[3][2]=NUMPAD_B;
        //cross_bg
        led_colors[7][0]=NUMPAD_R;
        led_colors[7][1]=NUMPAD_G;
        led_colors[7][2]=NUMPAD_B;
        led_colors[21][0]=NUMPAD_R;
        led_colors[21][1]=NUMPAD_G;
        led_colors[21][2]=NUMPAD_B;
        led_colors[9][0]=NUMPAD_R;
        led_colors[9][1]=NUMPAD_G;
        led_colors[9][2]=NUMPAD_B;
        led_colors[15][0]=NUMPAD_R;
        led_colors[15][1]=NUMPAD_G;
        led_colors[15][2]=NUMPAD_B;
        //bottom row
        led_colors[10][0]=NUMPAD_R;
        led_colors[10][1]=NUMPAD_G;
        led_colors[10][2]=NUMPAD_B;
        led_colors[14][0]=DEFAULT_R;
        led_colors[14][1]=DEFAULT_G;
        led_colors[14][2]=DEFAULT_B;
    }

    if (layer_state_is(1))
    {
        //2nd row
        led_colors[4][0]=0;
        led_colors[4][1]=0;
        led_colors[4][2]=255;
        led_colors[0][0]=DEFAULT_R;
        led_colors[0][1]=DEFAULT_G;
        led_colors[0][2]=DEFAULT_B;
        led_colors[20][0]=DEFAULT_R;
        led_colors[20][1]=DEFAULT_G;
        led_colors[20][2]=DEFAULT_B;
        //right column
        led_colors[18][0]=DEFAULT_R;
        led_colors[18][1]=DEFAULT_G;
        led_colors[18][2]=DEFAULT_B;
        led_colors[16][0]=DEFAULT_R;
        led_colors[16][1]=DEFAULT_G;
        led_colors[16][2]=DEFAULT_B;
        led_colors[19][0]=DEFAULT_R;
        led_colors[19][1]=DEFAULT_G;
        led_colors[19][2]=DEFAULT_B;
        led_colors[13][0]=255;
        led_colors[13][1]=0;
        led_colors[13][2]=0;
        led_colors[12][0]=0;
        led_colors[12][1]=255;
        led_colors[12][2]=0;
        //cross
        led_colors[1][0]=0;
        led_colors[1][1]=255;
        led_colors[1][2]=0;
        led_colors[6][0]=0;
        led_colors[6][1]=255;
        led_colors[6][2]=0;
        led_colors[11][0]=0;
        led_colors[11][1]=255;
        led_colors[11][2]=0;
        led_colors[23][0]=0;
        led_colors[23][1]=255;
        led_colors[23][2]=0;
        //center
        led_colors[3][0]=0;
        led_colors[3][1]=255;
        led_colors[3][2]=0;
        //cross_bg
        led_colors[7][0]=DEFAULT_R;
        led_colors[7][1]=DEFAULT_G;
        led_colors[7][2]=DEFAULT_B;
        led_colors[21][0]=255;
        led_colors[21][1]=50;
        led_colors[21][2]=0;
        led_colors[9][0]=DEFAULT_R;
        led_colors[9][1]=DEFAULT_G;
        led_colors[9][2]=DEFAULT_B;
        led_colors[15][0]=255;
        led_colors[15][1]=50;
        led_colors[15][2]=0;
        //bottom row
        led_colors[10][0]=255;
        led_colors[10][1]=0;
        led_colors[10][2]=0;
        led_colors[14][0]=150;
        led_colors[14][1]=150;
        led_colors[14][2]=0;
        led_colors[12][0]=255;
        led_colors[12][1]=255;
        led_colors[12][2]=255;

    }

    if (layer_state_is(2))
    {
        //2nd row
        led_colors[4][0]=DEFAULT_R;
        led_colors[4][1]=DEFAULT_G;
        led_colors[4][2]=DEFAULT_B;
        led_colors[0][0]=DEFAULT_R;
        led_colors[0][1]=DEFAULT_G;
        led_colors[0][2]=DEFAULT_B;
        led_colors[20][0]=DEFAULT_R;
        led_colors[20][1]=DEFAULT_G;
        led_colors[20][2]=DEFAULT_B;
        //right column
        led_colors[18][0]=DEFAULT_R;
        led_colors[18][1]=DEFAULT_G;
        led_colors[18][2]=DEFAULT_B;
        led_colors[16][0]=DEFAULT_R;
        led_colors[16][1]=DEFAULT_G;
        led_colors[16][2]=DEFAULT_B;
        led_colors[19][0]=DEFAULT_R;
        led_colors[19][1]=DEFAULT_G;
        led_colors[19][2]=DEFAULT_B;
        led_colors[13][0]=0;
        led_colors[13][1]=0;
        led_colors[13][2]=255;
        led_colors[12][0]=0;
        led_colors[12][1]=0;
        led_colors[12][2]=255;
        //cross
        led_colors[1][0]=DEFAULT_R;
        led_colors[1][1]=DEFAULT_G;
        led_colors[1][2]=DEFAULT_B;
        led_colors[6][0]=DEFAULT_R;
        led_colors[6][1]=DEFAULT_G;
        led_colors[6][2]=DEFAULT_B;
        led_colors[11][0]=DEFAULT_R;
        led_colors[11][1]=DEFAULT_G;
        led_colors[11][2]=DEFAULT_B;
        led_colors[23][0]=DEFAULT_R;
        led_colors[23][1]=DEFAULT_G;
        led_colors[23][2]=DEFAULT_B;
        led_colors[3][0]=DEFAULT_R;
        led_colors[3][1]=DEFAULT_G;
        led_colors[3][2]=DEFAULT_B;
        //center
        led_colors[3][0]=DEFAULT_R;
        led_colors[3][1]=DEFAULT_G;
        led_colors[3][2]=DEFAULT_B;
        //cross_bg
        led_colors[7][0]=DEFAULT_R;
        led_colors[7][1]=DEFAULT_G;
        led_colors[7][2]=DEFAULT_B;
        led_colors[21][0]=DEFAULT_R;
        led_colors[21][1]=DEFAULT_G;
        led_colors[21][2]=DEFAULT_B;
        led_colors[9][0]=DEFAULT_R;
        led_colors[9][1]=DEFAULT_G;
        led_colors[9][2]=DEFAULT_B;
        led_colors[15][0]=DEFAULT_R;
        led_colors[15][1]=DEFAULT_G;
        led_colors[15][2]=DEFAULT_B;
        //bottom row
        led_colors[10][0]=DEFAULT_R;
        led_colors[10][1]=DEFAULT_G;
        led_colors[10][2]=DEFAULT_B;
        led_colors[14][0]=DEFAULT_R;
        led_colors[14][1]=DEFAULT_G;
        led_colors[14][2]=DEFAULT_B;
        led_colors[12][0]=DEFAULT_R;
        led_colors[12][1]=DEFAULT_G;
        led_colors[12][2]=DEFAULT_B;

    }

    if (layer_state_is(3))
    {
        led_colors[13][0]=0;
        led_colors[13][1]=0;
        led_colors[13][2]=0;
        led_colors[12][0]=0;
        led_colors[12][1]=0;
        led_colors[12][2]=0;
    }

    for (int i = 0; i < 24; i++) {
        uint8_t r = DEFAULT_R, g = DEFAULT_G, b = DEFAULT_B;

        if (led_colors[i][0] || led_colors[i][1] || led_colors[i][2]) {
            r = (led_colors[i][0] * ledbright) / MAX_BRIGHTNESS;
            g = (led_colors[i][1] * ledbright) / MAX_BRIGHTNESS;
            b = (led_colors[i][2] * ledbright) / MAX_BRIGHTNESS;
        } else {
            r = (DEFAULT_R * ledbright) / MAX_BRIGHTNESS;
            g = (DEFAULT_G * ledbright) / MAX_BRIGHTNESS;
            b = (DEFAULT_B * ledbright) / MAX_BRIGHTNESS;
        }
        rgb_matrix_set_color(i, r, g, b);
    }
    /*
    cycle_tab_color();
    */
    return true;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    if (record->event.pressed) {
        if (keycode == MACRO_BRIGHT_DOWN) {
            if (ledbright > MIN_BRIGHTNESS) {
                ledbright -= 1;
            }
        } else if (keycode == MACRO_BRIGHT_UP) {
            if (ledbright < MAX_BRIGHTNESS) {
                ledbright += 1;
            }
        }
    }
    return false;
}

```

the only thing I did not get to work was the brightness control.

Did it work with your setup? and how did you assign the macros?

---

<div class="post-metadata">

**Author:** ![Per\_Magnus\_Tveten](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Per\_Magnus\_Tveten](https://community.frame.work/u/Per_Magnus_Tveten)\
**Post date:** [October 5, 2026, 8:16am UTC](https://community.frame.work/t/per-layer-rgb-control/84982/6 "2026-10-05T08:16:42Z")

</div>

yeah pretty sure it did…but found that the value of 20 was just right…

enum custom\_keycodes {  
MACRO\_BRIGHT\_UP = SAFE\_RANGE,  
MACRO\_BRIGHT\_DOWN  
};

so this bit should make the keycode a unused code

so then thats the key code to use in the layout.

---

<div class="post-metadata">

**Author:** ![Per\_Magnus\_Tveten](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Per\_Magnus\_Tveten](https://community.frame.work/u/Per_Magnus_Tveten)\
**Post date:** [October 5, 2026, 8:24am UTC](https://community.frame.work/t/per-layer-rgb-control/84982/7 "2026-10-05T08:24:20Z")

</div>

just tested it and yeah it works…  
(what ever weird thing I have done it also acts as if I click the function of what ever is on F9)  
but yeah it increases and decreases the brightness…

[3] = LAYOUT(

```
    KC_NO, KC_NO, MACRO_BRIGHT_UP, MACRO_BRIGHT_DOWN,

    KC_F1, KC_F2, KC_F3, KC_F4,

```
