Logitech RGB LED Illumination Functions: the Keyboard


GeeXLab 0.13.0 comes with a new set of functions to deal with all of the LED backlighting and RGB capabilities of Logitech G products.

Thanks to this support, every owner of a Logitech G product can easily control the RGB lighting of its device.

The new set of functions (on Windows only) is available in Lua and Python and the documentation is available here: gh_logiled.

I tested this new lib on the unique Logitech G device I own that supports LED backlighting: the G810 Orion keyboard.


Logitech LED illumination SDK demo
Demo – animated red color on F1..F12 keys

 
The use of the gh_logiled is simple. To set the same RGB color to all keys, just call set_lighting():

r = 100
g = 0
b = 0
gh_logiled.set_lighting(r, g, b)

 
100 is the max value. The white color is {R=100, G=100, B=100}. The red color is {R=100, G=0, B=0} and so on.

To set the color of a particular key, just call set_key_lighting():

local lib_dir = gh_utils.get_scripting_libs_dir()
dofile(lib_dir .. "lua/logitech_led_sdk_codes.lua")

key_code = LOGILED_A
gh_logiled.set_key_lighting(key_code, 0, 100, 0)

 
In Lua, the definition of all keys is available here: {GeeXLab folder}/libs/lua/logitech_led_sdk_codes.lua file. This file can be easily ported to Python if needed.

The following functions allow to play some hard-coded lighting effects:
– flash effect:

gh_logiled.set_flash_lighting(100, 50, 50,   5000, 500)

– pulse effect:

gh_logiled.set_pulse_lighting(100, 0, 10,   5000, 500)

 
If you wish to stop all effects and restore original colors, just call:

gh_logiled.stop_effects()

 
When GeeXLab is stopped, the original colors are automatically restored.

I said that gh_logiled can be used to control the RGB lighting of any compatible Logitech G products. But a keyboard with its numerous keys is different from a mouse. So to target a particular Logitech G device, there is a function:

gh_logiled.set_target(target) 

 
target can be "perkey_rgb" for the keyboard or "rgb" for the mouse. To target the keyboard and the mouse, just call gh_logiled.set_target() like this:

gh_logiled.set_target("perkey_rgb | rgb")

 
By default, the target is the keyboard.

I prepared two demos that show how to play with Logitech LED illumination functions. These demos are available in the gl-32/logitech_led_sdk/ folder of the code sample pack.

Leave a Reply

Your email address will not be published. Required fields are marked *