Skip to content

Setup RGB

tl;dr

Add library to your keyboard drive, set klor_rgb = "basic_rgb" or "peg_rgb", customize your RGB code and add RGB keycodes to your keymap to control your lighting.

Necessary library

Make sure that you added the library into your keyboard's 'lib' folder:
'neopixel.mpy' (file)

Image title

Chose your RGB mode

Afterwards you have to change the variable klor_rgb from "none" to either "basic_rgb" or "peg_rgb" in your main.py file and also set klor_variant to your own KLOR variant:

klor_variant = "saegewerk" #<- Change this to your own KLOR variant: "polydactyl", "konrad", "yubitsume", "saegewerk"
klor_rgb = "none"  #<- Change this to "basic_rgb" OR "peg_rgb"
klor_oled = False
klor_speaker = False

Basic RGB vs PEG RGB

If you need to address LEDs individually (so change specific LEDs to a different color) use peg_rgb in any other case use the more powerful basic_rgb implementation.

I would recommend going with basic_rgb.

Customize your RGB experience

Basic RGB

You can find the code in your kb.py file:

kb.py
        rgb = RGB(
            pixel_pin=self.rgb_pixel_pin,
            num_pixels=pixels,
            val_limit=50,
            hue_default=0,
            sat_default=100,
            val_default=20,
        )

Consider changing hue_default, sat_default or val_default. Use a value in the range 0-255.
Read more about the possible configuration options HERE.

You can also change the colors and much more at runtime via RGB keycodes.

PEG RGB

You can find the code in your kb.py file:

kb.py
# EDIT your [R, G, B] values below if you set the variable klor_rgb = 'peg_rgb':
rgb_data = [
                 [0, 191, 255], [0, 255, 128], [63, 255, 0], [254, 255, 0], [251, 64, 0],                                                              [251, 64, 0], [254, 255, 0], [63, 255, 0], [0, 255, 128], [0, 191, 255],
    [0, 0, 255], [0, 191, 255], [0, 255, 128], [63, 255, 0], [254, 255, 0], [251, 64, 0],                                                              [251, 64, 0], [254, 255, 0], [63, 255, 0], [0, 255, 128], [0, 191, 255], [0, 0, 255],
    [0, 0, 255], [0, 191, 255], [0, 255, 128], [63, 255, 0], [254, 255, 0], [251, 64, 0],                                                              [251, 64, 0], [254, 255, 0], [63, 255, 0], [0, 255, 128], [0, 191, 255], [0, 0, 255],
                                                             [254, 255, 0], [251, 64, 0], [247, 0, 122], [188, 0, 249],   [188, 0, 249], [247, 0, 122],[251, 64, 0], [254, 255, 0],
]

Each [R, G, B] list matches a KLOR key as seen in led_positions. Keep in mind that some KLOR variants have less keys.
Adjust [R, G, B] with a value between [0-255, 0-255, 0-255].


Instead of using RGB codes, such as [255,55,55], one can use Color classes like Color.RED or Color.GREEN.
Uncomment from kmk.extensions.peg_rgb_matrix import Color in kb.py (by removing the # infront of it) to activate this feature.
HERE is a list of predefined color names.

It is possible to mix and match RGB codes with Color classes e.g.:

Example: RGB codes mixed with Color classes
rgb_data = [
    Color.BLUE, [0, 255, 128], Color.RED, #[...]
]

You can't adjust colors at runtime with peg_rgb via keycodes.

Add RGB keycodes to your keymap

Add some keycodes to your keymap in order to control your RGB lighting e.g.: turn it on or off via KC.RGB_TOG

Use these keycodes (yes, there are only three).