Color is transformed between RGB and GRB

This commit is contained in:
ollo 2017-01-04 21:31:57 +01:00
parent 9adf5b9ed7
commit 2acd9af762

View File

@ -100,12 +100,12 @@ function fillDynamicMap()
if (colorBg == nil) then if (colorBg == nil) then
colorBg=string.char(0,0,0) -- black is the default background color colorBg=string.char(0,0,0) -- black is the default background color
end 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 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,1)) .. string.format("%02x",string.byte(color1,2)) .. string.format("%02x",string.byte(color1,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,1)) .. string.format("%02x",string.byte(color2,2)) .. string.format("%02x",string.byte(color2,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,1)) .. string.format("%02x",string.byte(color3,2)) .. string.format("%02x",string.byte(color3,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,1)) .. string.format("%02x",string.byte(color4,2)) .. string.format("%02x",string.byte(color4,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,1)) .. string.format("%02x",string.byte(colorBg,2)) .. string.format("%02x",string.byte(colorBg,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["$SSID"]=ssid
replaceMap["$SNTPSERVER"]=sntpserverhostname replaceMap["$SNTPSERVER"]=sntpserverhostname
@ -173,54 +173,54 @@ function startWebServer()
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
color=string.char(red, green, blue) color=string.char(green, red, blue)
end end
if ( _POST.colorMin1 ~= nil) then if ( _POST.colorMin1 ~= nil) then
local hexColor=string.sub(_POST.colorMin1, 4) local hexColor=string.sub(_POST.colorMin1, 4)
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
color1=string.char(red, green, blue) color1=string.char(green, red, blue)
end end
if ( _POST.colorMin2 ~= nil) then if ( _POST.colorMin2 ~= nil) then
local hexColor=string.sub(_POST.colorMin2, 4) local hexColor=string.sub(_POST.colorMin2, 4)
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
color2=string.char(red, green, blue) color2=string.char(green, red, blue)
end end
if ( _POST.colorMin3 ~= nil) then if ( _POST.colorMin3 ~= nil) then
local hexColor=string.sub(_POST.colorMin3, 4) local hexColor=string.sub(_POST.colorMin3, 4)
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
color3=string.char(red, green, blue) color3=string.char(green, red, blue)
end end
if ( _POST.colorMin4 ~= nil) then if ( _POST.colorMin4 ~= nil) then
local hexColor=string.sub(_POST.colorMin4, 4) local hexColor=string.sub(_POST.colorMin4, 4)
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
color4=string.char(red, green, blue) color4=string.char(green, red, blue)
end end
if ( _POST.bcolor ~= nil) then if ( _POST.bcolor ~= nil) then
local hexColor=string.sub(_POST.bcolor, 4) local hexColor=string.sub(_POST.bcolor, 4)
local red = tonumber(string.sub(hexColor, 1, 2), 16) local red = tonumber(string.sub(hexColor, 1, 2), 16)
local green = tonumber(string.sub(hexColor, 3, 4), 16) local green = tonumber(string.sub(hexColor, 3, 4), 16)
local blue = tonumber(string.sub(hexColor, 5, 6), 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 -- fill the current values
colorBg=string.char(red, green, blue) colorBg=string.char(green, red, blue)
end end
if (getTime ~= nil) then if (getTime ~= nil) then
time = getTime(sec, timezoneoffset) time = getTime(sec, timezoneoffset)