From 2acd9af762fc2afd66d5a2284300de447d14ba51 Mon Sep 17 00:00:00 2001 From: ollo Date: Wed, 4 Jan 2017 21:31:57 +0100 Subject: [PATCH] Color is transformed between RGB and GRB --- webserver.lua | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/webserver.lua b/webserver.lua index 23d5593..c61ea10 100644 --- a/webserver.lua +++ b/webserver.lua @@ -100,12 +100,12 @@ function fillDynamicMap() if (colorBg == nil) then colorBg=string.char(0,0,0) -- black is the default background color end - local hexColor = "#" .. string.format("%02x",string.byte(color,1)) .. string.format("%02x",string.byte(color,2)) .. string.format("%02x",string.byte(color,3)) - local hexColor1 = "#" .. string.format("%02x",string.byte(color1,1)) .. string.format("%02x",string.byte(color1,2)) .. string.format("%02x",string.byte(color1,3)) - local hexColor2 = "#" .. string.format("%02x",string.byte(color2,1)) .. string.format("%02x",string.byte(color2,2)) .. string.format("%02x",string.byte(color2,3)) - local hexColor3 = "#" .. string.format("%02x",string.byte(color3,1)) .. string.format("%02x",string.byte(color3,2)) .. string.format("%02x",string.byte(color3,3)) - local hexColor4 = "#" .. string.format("%02x",string.byte(color4,1)) .. string.format("%02x",string.byte(color4,2)) .. string.format("%02x",string.byte(color4,3)) - local hexColorBg = "#" .. string.format("%02x",string.byte(colorBg,1)) .. string.format("%02x",string.byte(colorBg,2)) .. string.format("%02x",string.byte(colorBg,3)) + local hexColor = "#" .. string.format("%02x",string.byte(color,2)) .. string.format("%02x",string.byte(color,1)) .. string.format("%02x",string.byte(color,3)) + local hexColor1 = "#" .. string.format("%02x",string.byte(color1,2)) .. string.format("%02x",string.byte(color1,1)) .. string.format("%02x",string.byte(color1,3)) + local hexColor2 = "#" .. string.format("%02x",string.byte(color2,2)) .. string.format("%02x",string.byte(color2,1)) .. string.format("%02x",string.byte(color2,3)) + local hexColor3 = "#" .. string.format("%02x",string.byte(color3,2)) .. string.format("%02x",string.byte(color3,1)) .. string.format("%02x",string.byte(color3,3)) + local hexColor4 = "#" .. string.format("%02x",string.byte(color4,2)) .. string.format("%02x",string.byte(color4,1)) .. string.format("%02x",string.byte(color4,3)) + local hexColorBg = "#" .. string.format("%02x",string.byte(colorBg,2)) .. string.format("%02x",string.byte(colorBg,1)) .. string.format("%02x",string.byte(colorBg,3)) replaceMap["$SSID"]=ssid replaceMap["$SNTPSERVER"]=sntpserverhostname @@ -173,54 +173,54 @@ function startWebServer() local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("color=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("color=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - color=string.char(red, green, blue) + color=string.char(green, red, blue) end if ( _POST.colorMin1 ~= nil) then local hexColor=string.sub(_POST.colorMin1, 4) local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("color1=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("color1=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - color1=string.char(red, green, blue) + color1=string.char(green, red, blue) end if ( _POST.colorMin2 ~= nil) then local hexColor=string.sub(_POST.colorMin2, 4) local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("color2=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("color2=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - color2=string.char(red, green, blue) + color2=string.char(green, red, blue) end if ( _POST.colorMin3 ~= nil) then local hexColor=string.sub(_POST.colorMin3, 4) local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("color3=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("color3=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - color3=string.char(red, green, blue) + color3=string.char(green, red, blue) end if ( _POST.colorMin4 ~= nil) then local hexColor=string.sub(_POST.colorMin4, 4) local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("color4=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("color4=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - color4=string.char(red, green, blue) + color4=string.char(green, red, blue) end if ( _POST.bcolor ~= nil) then local hexColor=string.sub(_POST.bcolor, 4) local red = tonumber(string.sub(hexColor, 1, 2), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16) local blue = tonumber(string.sub(hexColor, 5, 6), 16) - file.write("colorBg=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n") + file.write("colorBg=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n") -- fill the current values - colorBg=string.char(red, green, blue) + colorBg=string.char(green, red, blue) end if (getTime ~= nil) then time = getTime(sec, timezoneoffset)