Created
March 15, 2012 02:07
-
-
Save LindseyB/2041210 to your computer and use it in GitHub Desktop.
lua code to rotate colors on the logitech g510 keyboard when g18 is hit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function OnEvent(event, arg) | |
if (event == "PROFILE_ACTIVATED") then | |
r1, g1, b1 = 0, 0, 0 | |
end | |
if (event == "PROFILE_DEACTIVATED") then | |
color( 255, 0, 0, 50) | |
end | |
if (event == "G_PRESSED" and arg == 18) then | |
while true do | |
color( 255, 0, 0, 50) | |
color( 255, 100, 0, 50) | |
color( 255, 175, 0, 50) | |
color( 255, 255, 0, 50) | |
color( 175, 255, 0, 50) | |
color( 100, 255, 0, 50) | |
color( 0, 255, 0, 50) | |
color( 0, 255, 255, 50) | |
color( 0, 175, 255, 50) | |
color( 0, 80, 255, 50) | |
color( 0, 0, 255, 50) | |
color( 175, 0, 255, 50) | |
color( 255, 0, 255, 50) | |
color( 255, 0, 175, 50) | |
end | |
end | |
end | |
function color(r2, g2, b2, speed) | |
for loop = 5, 255, 50 do | |
SetBacklightColor((r2*loop+r1*(255-loop))/255, (g2*loop+g1*(255-loop))/255, (b2*loop+b1*(255-loop))/255 ,"kb"); | |
Sleep(speed) | |
end | |
r1 = r2 | |
g1 = g2 | |
b1 = b2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment