So I declare the list of colors to use in the lua file but I always get this green color and I do not understand where my error may come from.
Code: Select all
-- ColorChanger v1.3 by Smurfier (smurfier20@gmail.com)
-- This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
PROPERTIES={Colors='0,255,0|255,128,0|255,0,0';MeasureName='measureW1';MinimumValue=0;MaximumValue=10;}
function Initialize()
MinValue,Colors,Measure=tonumber(PROPERTIES.MinimumValue),{},SKIN:GetMeasure(PROPERTIES.MeasureName)
for a=1,4 do Colors[a]={} end
if string.len(PROPERTIES.Colors)==0 or not string.match(PROPERTIES.Colors,'%d+%s-,%s-%d+%s-,%s-%d+') then
print('ColorChanger: Invalid color string')
elseif not Measure then
print('ColorChanger: Cannot retrieve Measure '..PROPERTIES.MeasureName)
else
for a in string.gmatch(PROPERTIES.Colors,'[^%|]+') do
local b={}
for c in string.gmatch(a,'[^,]+') do table.insert(b,tonumber(c)) end
for d=1,4 do table.insert(Colors[d],b[d] and b[d] or 255) end
end
Divider=math.ceil((tonumber(PROPERTIES.MaximumValue)-MinValue)/(#Colors[1]-1))
end
end
function Update()
if #Colors[1]<2 or not Measure then
return #Colors[1]==1 and string.gsub(PROPERTIES.Colors,'|','') or '255,255,255,255'
else
local rValue,uColor=Measure:GetValue()-MinValue,{}
Num=math.floor(rValue/Divider)
for i=1,4 do table.insert(uColor,Average(Colors[i][Num+1],Colors[i][Num+2],rValue%Divider,Divider)) end
return table.concat(uColor,',')
end
end
function Average(a,b,c,d) return (a*(d-c)+(b and b or 0)*c)/d end
Code: Select all
; Weather info based on Rainmeter Illustro and VClouds Weather 2
[Rainmeter]
Update=300
[Metadata]
Name=Weather
Description=This skin shows the current weather conditions
[Variables]
fontName=Trebuchet MS
textSize=8
colorText=255,255,255,205
Key=6fe233ecf6999f2e8e6f4abb4b0d0b78
Lat=47.238
Lont=6.0243
Uni=ca
Lang=fr
;ConditionsWeather
[measureW0]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=https://api.darksky.net/forecast/#Key#/#Lat#,#Lont#?lang=#Lang#&units=#Uni#&exclude=hourly,flags
RegExp=(?siU).*uvIndex":(.*)},
;Index UV
[measureW1]
Measure=Plugin
Plugin=WebParser.dll
Url=[measureW0]
StringIndex=1
MinValue=0
MaxValue=10
Substitute="":"..."
[measureW1Lua]
Measure=Script
ScriptFile=\ColorChanger.lua
MeasureName=measureW1
; --------------------------
; METERS
; Note: not in reading order
; --------------------------
[meterLabelIndexUV]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=140
W=190
H=14
Text="Index UV"
[meterValueIndexUV]
Meter=STRING
MeterStyle=styleRightText
MeasureName=measureW1
X=200
Y=0r
W=190
H=14
Text="%1 / 10"
[meterBarIndexUV]
Meter=BAR
MeterStyle=styleBar
colorBar=#[measureW1Lua]#
MeasureName=measureW1
DynamicVariables=1
X=10
Y=152
W=190
H=1
; ----------------------------------
; STYLES
; ----------------------------------
[styleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1
[styleRightText]
StringAlign=RIGHT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1
[styleBar]
BarOrientation=HORIZONTAL
SolidColor=50,240,255,255