Skip to content

Instantly share code, notes, and snippets.

@mvrozanti
Last active July 10, 2024 02:51
Show Gist options
  • Save mvrozanti/ed836ec1add06ad282c552b5988b0c11 to your computer and use it in GitHub Desktop.
Save mvrozanti/ed836ec1add06ad282c552b5988b0c11 to your computer and use it in GitHub Desktop.
keys = keyleds.db
colorCapsLock = tocolor(keyleds.config.colorCapsLock)
colorScrollLock = tocolor(keyleds.config.colorScrollLock)
if type(keys) ~= "table" then
local tempKeys = {}
for i = 1, #keys do
table.insert(tempKeys, keys[i])
end
keys = tempKeys
end
function getKeyFromName(keyName)
for _, key in ipairs(keys) do
if key.name == keyName then
return key
end
end
end
buffer = RenderTarget:new()
function update(buffer)
if colorCapsLock then
buffer[getKeyFromName("CAPSLOCKLED")] = colorCapsLock
end
if colorScrollLock then
buffer[getKeyFromName("SCROLLLOCKLED")] = colorScrollLock
end
end
update(buffer)
function render(ms, target)
update(buffer)
target:blend(buffer)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment