# Legion RGB Control drives the four-zone backlight on Lenovo Legion laptops

> L5P-Keyboard-RGB is a GPL-3.0 licensed Rust program that controls the RGB lighting of the four-zone keyboard in Lenovo Legion and Ideapad Gaming laptops from 2020 to 2024, on Windows and Linux. It ships a GUI and a command line, supports effects defined in JSON, and is explicit about which models it cannot drive.

**4JX/L5P-Keyboard-RGB** — Cross platform software to control the RGB/lighting of the 4 zone keyboard included in the 2020, 2021, 2022, 2023 and 2024 lineup of the Lenovo Legion laptops. Works on Windows and Linux.

- Repository: https://github.com/4JX/L5P-Keyboard-RGB
- Stars: 524 · Forks: 70
- Language: Rust
- License: GPL-3.0
- Published: 2026-10-22 · Updated: 2026-10-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/4jx-l5p-keyboard-rgb

## What hardware this actually drives

The project description is specific about its scope: cross-platform software to control the RGB lighting of the four zone keyboard included in the 2020, 2021, 2022, 2023 and 2024 lineup of the Lenovo Legion laptops, working on Windows and Linux. The compatibility section narrows it further. The program has been tested to work on the Legion 5 Pro in the 2020, 2021, 2022, 2023 and 2024 model years, and on the Ideapad Gaming 3 for 2021, 2022, 2023 and 2024. The mechanism behind that restriction is the four-zone abstraction itself. A four-zone keyboard exposes lighting as four independently coloured groups of keys rather than per-key control, and the protocol used to drive those groups differs from the per-key one. The README is upfront about the cases it cannot handle. Legion 7i will not work because the backlight on those is per-key and uses a different way of communicating. Any variant with a white backlight is also out, since the author has not figured out how to talk to it, though with the limited number of states, off, low and high, there would not be many effects to add anyway.

## The stock effects and the custom ones

The effects list splits into what the hardware already does and what this program adds. The stock effects are Static, Breath, Smooth, LeftWave and RightWave, which is the full set the firmware offers. The custom ones add eight more. Lightning adds a little spark. AmbientLight reacts to content on your screen. Smooth left and right wave is an implementation of the classic wave effect. Left and right swipe transitions the selected colours from side to side, which the README says is useful for custom waves. Disco is described as a portable dance floor. Christmas is there for the festive season. Fade turns off the keyboard lights after a period of inactivity, which is the one effect with a practical rather than decorative purpose. And Temperature displays a gradient based on the current CPU temperature, and that one is Linux only. The implementation notes that the best way to add a new effect is to edit the source code directly because it allows the most flexibility, while the built-in feature file mechanism is for making basic effects.

## Effects as JSON, and what each field controls

Custom effects are written as a JSON file, and the format section documents every field.

```json
{
  "effect_steps": [
    {"rgb_array": [0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0], "step_type": "Set", "brightness": 1, "steps": 100, "delay_between_steps": 100, "sleep": 100},
    {"rgb_array": [0, 100, 0, 0, 0, 200, 0, 0, 200, 200, 0, 0], "step_type": "Transition", "brightness": 1, "steps": 100, "delay_between_steps": 100, "sleep": 100}
  ],
  "should_loop": true
}
```

The effect_steps array holds the steps the effect goes through. Each step carries an rgb_array in the r, g, b, r, g, b format, which is four zones times three channels, and a step_type that is either Set to swap the colours instantly or Transition to move to them smoothly. Brightness is 1 for low or 2 for high. The steps field controls how finely the transition happens, since the LEDs are set at small intervals until they reach the desired colour, and delay_between_steps is how long to wait between those intervals in milliseconds. The sleep field is the pause before moving to the next step, also in milliseconds. The top-level should_loop decides whether the effect starts again after the last step. The fact that the colour array is twelve values for four zones is the clearest single hint at what the hardware supports.

## The udev rule, and why you can avoid running as root

By default on Linux you have to run the program with root privileges, and the README shows the udev rule that remedies it, placed in a path similar to /etc/udev/rules.d/99-kblight.rules.

```sh
SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="####", MODE="0666"
```

The vendor id 048d is Lenovo's, and the idProduct is filled in from the tables the README gives for the model year and variant. For 2024 the Pro is c995, Regular and Slim is c994 and the LOQ is c993; for 2023 the Pro is c985, Regular and Slim is c984 and the LOQ is c983. The 2022 lineup shares the Pro, Regular and Slim product c975 with the Ideapad c973, the 2021 line shares c965 with the Ideapad c963, and 2020 is c955 alone. After editing the rule you reload it.

```sh
sudo udevadm control --reload-rules && sudo udevadm trigger
```

That is the whole Linux permission story, and it is worth doing before anything else, because running an RGB controller as root on a shared machine is not a good default.

## The GUI, the command line and the config file location

The program runs in two modes. In the GUI mode you execute the file by double-clicking on it, and you can pass extra startup options through the command line by also specifying the --gui flag. Configuration for this mode is saved by default in a file called settings.json in the folder the program was executed in, and you can override that location by setting the LEGION_KEYBOARD_CONFIG environment variable. The command line form is legion-kb-rgb with an options block and a subcommand.

```sh
legion-kb-rgb [OPTIONS] [SUBCOMMAND]
```

Getting the help prompt is legion-kb-rgb --help. Setting the keyboard to red takes an effect and a colour list.

```sh
legion-kb-rgb set -e Static -c 255,0,0,255,0,0,255,0,0,255,0,0
```

And the SmoothWave effect going to the left with speed 4 and brightness at high is.

```sh
legion-kb-rgb set -e SmoothWave -s 4 -b 2 -d Left
```

The twelve-number colour argument matches the four zones of three channels, and the -d argument takes the direction.

## Building it, and the crate layout

Building from source needs Rust and Git, and on Ubuntu a long list of development packages for the GTK stack, X11, XCB, udev, D-Bus, GStreamer and the xdo library, which is what the input layer relies on.

```sh
sudo apt-get install -y libclang-dev libxcb-shm0-dev libusb-1.0-0-dev libx11-dev nasm libdbus-1-dev libudev-dev libxcb-randr0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libxi-dev libxtst-dev libpango1.0-dev libgtk-3-dev libxdo-dev libappindicator3-dev
```

The workspace is split into three crates, with members app, driver and input, which maps onto the three concerns: the user interface, the protocol driver that talks to the keyboard, and the input layer that captures screen content for the AmbientLight effect. The topics list confirms the GUI toolkit, egui, alongside effects, keyboard, legion and lenovo. There is also a Makefile.toml for cargo-make, a flake.nix and flake.lock for Nix, a vcpkg.json for Windows, an .envrc for direnv and a rustfmt.toml. Pre-built binaries are uploaded periodically to the releases tab, and pre-compiled artifacts from the CI workflow are also available but require a GitHub account.

## Where Legion RGB Control is the wrong choice

Three limits, and the first one is hardware rather than software. If your keyboard is per-key, such as the Legion 7i, the tool cannot drive it, and the README does not promise to change that. If your keyboard has only a white backlight, there is nothing to gain either. The second is the effort curve for the effects people actually care about. The JSON mechanism covers basic effects, and the README says plainly that editing the source is the best way to add a new effect because it allows the most flexibility, so the JSON path is a convenience rather than a plugin API. Anyone wanting something beyond a gradient will end up in Rust. The third is the warning the download section carries, that you should use it at your own risk and the developer is not responsible for any damages. That is standard for a tool that writes to a USB device's registers, and it means the cost of a bad interaction falls on you. The project is GPL-3.0 licensed, so a fork is easy and redistribution carries the copyleft obligation, which is the usual arrangement for this kind of hardware tool.

## Conclusion

Adopt Legion RGB Control if you own one of the listed Legion or Ideapad Gaming models and want the stock and custom effects that Lenovo's own software does not expose on Linux. Skip it if you have a Legion 7i, because the README says per-key backlighting on those uses a different communication method and will not work. Before you install, add the udev rule so the tool does not need root, and check the idProduct table for your model year.

## FAQ

### Which laptops does Legion RGB Control support?

It has been tested on the Legion 5 Pro for the 2020, 2021, 2022, 2023 and 2024 model years and on the Ideapad Gaming 3 for 2021 through 2024. It will not work on the Legion 7i, whose backlight is per-key and uses a different communication method, and variants with a white backlight are not supported either.

### How do I set a static colour from the command line?

Use the set subcommand with an effect and a colour list of twelve values, one triple of red, green and blue per zone, for example `legion-kb-rgb set -e Static -c 255,0,0,255,0,0,255,0,0,255,0,0`. Run `legion-kb-rgb --help` for the full prompt.

### Can I define my own lighting effects?

Yes, with a JSON file containing an effect_steps array and a should_loop flag. Each step has an rgb_array of colours, a step_type of Set or Transition, a brightness of 1 or 2, a steps count, a delay_between_steps in milliseconds and a sleep in milliseconds. The README notes that editing the source directly offers the most flexibility for new effects.

### Do I need root on Linux to use Legion RGB Control?

By default yes, but the README shows a udev rule that removes the requirement, placed in a path like /etc/udev/rules.d/99-kblight.rules and matching the Lenovo vendor id 048d with your model's idProduct from the tables. After editing it you reload the rules with sudo udevadm control --reload-rules and sudo udevadm trigger.

## Sources

- [4JX/L5P-Keyboard-RGB on GitHub](https://github.com/4JX/L5P-Keyboard-RGB)
- [Issues](https://github.com/4JX/L5P-Keyboard-RGB/issues)
- [License: GPL-3.0](https://github.com/4JX/L5P-Keyboard-RGB/blob/main/LICENSE)
- [README](https://github.com/4JX/L5P-Keyboard-RGB/blob/main/README.md)
- [Releases](https://github.com/4JX/L5P-Keyboard-RGB/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/4jx-l5p-keyboard-rgb
