balala wrote: ↑August 8th, 2020, 6:48 pm Here is the promissed code. This time zou don!t have to use -1 for the components of the not used colors, all those components can be left empty (in the posted code the components of colors from 6 to 10 are left so).
Unfortunately I added even more measures (replaced the [MeasureColorX] measures with [MeasureColorXRed], [MeasureColorXGreen] and [MeasureColorXBlue]).
Please let me know your opinion.Code: Select all
[Rainmeter] Update=1000 [Variables] R1=198 G1=251 B1=200 R2=196 G2=92 B2=38 R3=14 G3=175 B3=67 R4=19 G4=196 B4=118 R5=58 G5=95 B5=5 R6= G6= B6= R7= G7= B7= R8= G8= B8= R9= G9= B9= R10= G10= B10= Range=0 [MeasureColor3Red] Measure=String String=#R3# IfMatch=^$|^-1$|#*R3*# IfMatchAction=[!SetVariable Color3R "0"][!SetVariable R3 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color3R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor3Green] Measure=String String=#G3# IfMatch=^$|^-1$|#*G3*# IfMatchAction=[!SetVariable Color3G "0"][!SetVariable G3 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color3G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor3Blue] Measure=String String=#B3# IfMatch=^$|^-1$|#*B3*# IfMatchAction=[!SetVariable Color3B "0"][!SetVariable B3 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color3B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor4Red] Measure=String String=#R4# IfMatch=^$|^-1$|#*R4*# IfMatchAction=[!SetVariable Color4R "0"][!SetVariable R4 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color4R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor4Green] Measure=String String=#G4# IfMatch=^$|^-1$|#*G4*# IfMatchAction=[!SetVariable Color4G "0"][!SetVariable G4 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color4G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor4Blue] Measure=String String=#B4# IfMatch=^$|^-1$|#*B4*# IfMatchAction=[!SetVariable Color4B "0"][!SetVariable B4 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color4B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor5Red] Measure=String String=#R5# IfMatch=^$|^-1$|#*R5*# IfMatchAction=[!SetVariable Color5R "0"][!SetVariable R5 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color5R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor5Green] Measure=String String=#G5# IfMatch=^$|^-1$|#*G5*# IfMatchAction=[!SetVariable Color5G "0"][!SetVariable G5 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color5G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor5Blue] Measure=String String=#B5# IfMatch=^$|^-1$|#*B5*# IfMatchAction=[!SetVariable Color5B "0"][!SetVariable B5 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color5B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor6Red] Measure=String String=#R6# IfMatch=^$|^-1$|#*R6*# IfMatchAction=[!SetVariable Color6R "0"][!SetVariable R6 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color6R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor6Green] Measure=String String=#G6# IfMatch=^$|^-1$|#*G6*# IfMatchAction=[!SetVariable Color6G "0"][!SetVariable G6 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color6G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor6Blue] Measure=String String=#B6# IfMatch=^$|^-1$|#*B6*# IfMatchAction=[!SetVariable Color6B "0"][!SetVariable B6 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color6B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor7Red] Measure=String String=#R7# IfMatch=^$|^-1$|#*R7*# IfMatchAction=[!SetVariable Color7R "0"][!SetVariable R7 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color7R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor7Green] Measure=String String=#G7# IfMatch=^$|^-1$|#*G7*# IfMatchAction=[!SetVariable Color7G "0"][!SetVariable G7 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color7G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor7Blue] Measure=String String=#B7# IfMatch=^$|^-1$|#*B7*# IfMatchAction=[!SetVariable Color7B "0"][!SetVariable B7 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color7B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor8Red] Measure=String String=#R8# IfMatch=^$|^-1$|#*R8*# IfMatchAction=[!SetVariable Color8R "0"][!SetVariable R8 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color8R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor8Green] Measure=String String=#G8# IfMatch=^$|^-1$|#*G8*# IfMatchAction=[!SetVariable Color8G "0"][!SetVariable G8 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color8G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor8Blue] Measure=String String=#B8# IfMatch=^$|^-1$|#*B8*# IfMatchAction=[!SetVariable Color8B "0"][!SetVariable B8 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color8B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor9Red] Measure=String String=#R9# IfMatch=^$|^-1$|#*R9*# IfMatchAction=[!SetVariable Color9R "0"][!SetVariable R9 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color9R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor9Green] Measure=String String=#G9# IfMatch=^$|^-1$|#*G9*# IfMatchAction=[!SetVariable Color9G "0"][!SetVariable G9 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color9G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor9Blue] Measure=String String=#B9# IfMatch=^$|^-1$|#*B9*# IfMatchAction=[!SetVariable Color9B "0"][!SetVariable B9 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color9B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor10Red] Measure=String String=#R10# IfMatch=^$|^-1$|#*R10*# IfMatchAction=[!SetVariable Color10R "0"][!SetVariable R10 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color10R "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor10Green] Measure=String String=#G10# IfMatch=^$|^-1$|#*G10*# IfMatchAction=[!SetVariable Color10G "0"][!SetVariable G10 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color10G "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureColor10Blue] Measure=String String=#B10# IfMatch=^$|^-1$|#*B10*# IfMatchAction=[!SetVariable Color10B "0"][!SetVariable B10 "-1"][!UpdateMeasure "MeasureNumOfColors"] IfNotMatchAction=[!SetVariable Color10B "1"][!UpdateMeasure "MeasureNumOfColors"] UpdateDivider=-1 [MeasureNumOfColors] Measure=Calc Formula=( Floor (( 6 + #Color3R# + #Color3G# + #Color3B# + #Color4R# + #Color4G# + #Color4B# + #Color5R# + #Color5G# + #Color5B# + #Color6R# + #Color6G# + #Color6B# + #Color7R# + #Color7G# + #Color7B# + #Color8R# + #Color8G# + #Color8B# + #Color9R# + #Color9G# + #Color9B# + #Color10R# + #Color10G# + #Color10B# ) / 3 )) DynamicVariables=1 UpdateDivider=-1 [MeterColor] Meter=Image SolidColor=(((#Range#<=(100/([MeasureNumOfColors]-1)))*(#R1#+(#Range#/(100/([MeasureNumOfColors]-1)))*(#R2#-#R1#)))+(((#Range#>(100/([MeasureNumOfColors]-1)))&&(#Range#<=(200/([MeasureNumOfColors]-1))))*(#R2#+((#Range#-(100/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R3#-#R2#)))+(((#Range#>(200/([MeasureNumOfColors]-1)))&&(#Range#<=(300/([MeasureNumOfColors]-1))))*(#R3#+((#Range#-(200/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R4#-#R3#)))+(((#Range#>(300/([MeasureNumOfColors]-1)))&&(#Range#<=(400/([MeasureNumOfColors]-1))))*(#R4#+((#Range#-(300/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R5#-#R4#)))+(((#Range#>(400/([MeasureNumOfColors]-1)))&&(#Range#<=(500/([MeasureNumOfColors]-1))))*(#R5#+((#Range#-(400/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R6#-#R5#)))+(((#Range#>(500/([MeasureNumOfColors]-1)))&&(#Range#<=(600/([MeasureNumOfColors]-1))))*(#R6#+((#Range#-(500/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R7#-#R6#)))+(((#Range#>(600/([MeasureNumOfColors]-1)))&&(#Range#<=(700/([MeasureNumOfColors]-1))))*(#R7#+((#Range#-(600/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R8#-#R7#)))+(((#Range#>(700/([MeasureNumOfColors]-1)))&&(#Range#<=(800/([MeasureNumOfColors]-1))))*(#R8#+((#Range#-(700/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R9#-#R8#)))+(((#Range#>(800/([MeasureNumOfColors]-1)))&&(#Range#<=(900/([MeasureNumOfColors]-1))))*(#R9#+((#Range#-(800/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#R10#-#R9#)))),(((#Range#<=(100/([MeasureNumOfColors]-1)))*(#G1#+(#Range#/(100/([MeasureNumOfColors]-1)))*(#G2#-#G1#)))+(((#Range#>(100/([MeasureNumOfColors]-1)))&&(#Range#<=(200/([MeasureNumOfColors]-1))))*(#G2#+((#Range#-(100/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G3#-#G2#)))+(((#Range#>(200/([MeasureNumOfColors]-1)))&&(#Range#<=(300/([MeasureNumOfColors]-1))))*(#G3#+((#Range#-(200/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G4#-#G3#)))+(((#Range#>(300/([MeasureNumOfColors]-1)))&&(#Range#<=(400/([MeasureNumOfColors]-1))))*(#G4#+((#Range#-(300/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G5#-#G4#)))+(((#Range#>(400/([MeasureNumOfColors]-1)))&&(#Range#<=(500/([MeasureNumOfColors]-1))))*(#G5#+((#Range#-(400/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G6#-#G5#)))+(((#Range#>(500/([MeasureNumOfColors]-1)))&&(#Range#<=(600/([MeasureNumOfColors]-1))))*(#G6#+((#Range#-(500/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G7#-#G6#)))+(((#Range#>(600/([MeasureNumOfColors]-1)))&&(#Range#<=(700/([MeasureNumOfColors]-1))))*(#G7#+((#Range#-(600/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G8#-#G7#)))+(((#Range#>(700/([MeasureNumOfColors]-1)))&&(#Range#<=(800/([MeasureNumOfColors]-1))))*(#G8#+((#Range#-(700/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G9#-#G8#)))+(((#Range#>(800/([MeasureNumOfColors]-1)))&&(#Range#<=(900/([MeasureNumOfColors]-1))))*(#G9#+((#Range#-(800/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#G10#-#G9#)))),(((#Range#<=(100/([MeasureNumOfColors]-1)))*(#B1#+(#Range#/(100/([MeasureNumOfColors]-1)))*(#B2#-#B1#)))+(((#Range#>(100/([MeasureNumOfColors]-1)))&&(#Range#<=(200/([MeasureNumOfColors]-1))))*(#B2#+((#Range#-(100/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B3#-#B2#)))+(((#Range#>(200/([MeasureNumOfColors]-1)))&&(#Range#<=(300/([MeasureNumOfColors]-1))))*(#B3#+((#Range#-(200/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B4#-#B3#)))+(((#Range#>(300/([MeasureNumOfColors]-1)))&&(#Range#<=(400/([MeasureNumOfColors]-1))))*(#B4#+((#Range#-(300/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B5#-#B4#)))+(((#Range#>(400/([MeasureNumOfColors]-1)))&&(#Range#<=(500/([MeasureNumOfColors]-1))))*(#B5#+((#Range#-(400/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B6#-#B5#)))+(((#Range#>(500/([MeasureNumOfColors]-1)))&&(#Range#<=(600/([MeasureNumOfColors]-1))))*(#B6#+((#Range#-(500/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B7#-#B6#)))+(((#Range#>(600/([MeasureNumOfColors]-1)))&&(#Range#<=(700/([MeasureNumOfColors]-1))))*(#B7#+((#Range#-(600/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B8#-#B7#)))+(((#Range#>(700/([MeasureNumOfColors]-1)))&&(#Range#<=(800/([MeasureNumOfColors]-1))))*(#B8#+((#Range#-(700/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B9#-#B8#)))+(((#Range#>(800/([MeasureNumOfColors]-1)))&&(#Range#<=(900/([MeasureNumOfColors]-1))))*(#B9#+((#Range#-(800/([MeasureNumOfColors]-1)))/(100/([MeasureNumOfColors]-1)))*(#B10#-#B9#)))) X=0 Y=0 W=100 H=50 DynamicVariables=1 MouseScrollDownAction=[!SetVariable Range "(Clamp((#Range#-1),0,100))"][!UpdateMeter "#CURRENTSECTION#"][!Redraw] MouseScrollUpAction=[!SetVariable Range "(Clamp((#Range#+1),0,100))"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
And here is my promised code, based precisely on your code:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
Colors="1:198,251,200,255;2:196,92,38,255;3:14,175,67,255;4:19,196,118,255;5:58,95,5,255;"
None=":-1,-1,-1,-1;"
Range=0
[MeasureSetRGBA]
Measure=String
String=#Colors#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(.)":"1#None#2#None#3#None#4#None#5#None#6#None#7#None#8#None#9#None#10#None#\1","(?U)(.+):(.+),(.+),(.+),(.+);":"[!SetVariable R\1 \2][!SetVariable G\1 \3][!SetVariable B\1 \4][!SetVariable A\1 \5]","(\d+)(\s+\S+\])$":"\1\2[!SetVariable NumOfColors \1]"
OnUpdateAction=[MeasureSetRGBA]
[MeterColor]
Meter=Image
SolidColor=(((#Range#<=(100/(#NumOfColors#-1)))*(#R1#+(#Range#/(100/(#NumOfColors#-1)))*(#R2#-#R1#)))+(((#Range#>(100/(#NumOfColors#-1)))&&(#Range#<=(200/(#NumOfColors#-1))))*(#R2#+((#Range#-(100/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R3#-#R2#)))+(((#Range#>(200/(#NumOfColors#-1)))&&(#Range#<=(300/(#NumOfColors#-1))))*(#R3#+((#Range#-(200/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R4#-#R3#)))+(((#Range#>(300/(#NumOfColors#-1)))&&(#Range#<=(400/(#NumOfColors#-1))))*(#R4#+((#Range#-(300/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R5#-#R4#)))+(((#Range#>(400/(#NumOfColors#-1)))&&(#Range#<=(500/(#NumOfColors#-1))))*(#R5#+((#Range#-(400/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R6#-#R5#)))+(((#Range#>(500/(#NumOfColors#-1)))&&(#Range#<=(600/(#NumOfColors#-1))))*(#R6#+((#Range#-(500/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R7#-#R6#)))+(((#Range#>(600/(#NumOfColors#-1)))&&(#Range#<=(700/(#NumOfColors#-1))))*(#R7#+((#Range#-(600/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R8#-#R7#)))+(((#Range#>(700/(#NumOfColors#-1)))&&(#Range#<=(800/(#NumOfColors#-1))))*(#R8#+((#Range#-(700/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R9#-#R8#)))+(((#Range#>(800/(#NumOfColors#-1)))&&(#Range#<=(900/(#NumOfColors#-1))))*(#R9#+((#Range#-(800/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#R10#-#R9#)))),(((#Range#<=(100/(#NumOfColors#-1)))*(#G1#+(#Range#/(100/(#NumOfColors#-1)))*(#G2#-#G1#)))+(((#Range#>(100/(#NumOfColors#-1)))&&(#Range#<=(200/(#NumOfColors#-1))))*(#G2#+((#Range#-(100/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G3#-#G2#)))+(((#Range#>(200/(#NumOfColors#-1)))&&(#Range#<=(300/(#NumOfColors#-1))))*(#G3#+((#Range#-(200/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G4#-#G3#)))+(((#Range#>(300/(#NumOfColors#-1)))&&(#Range#<=(400/(#NumOfColors#-1))))*(#G4#+((#Range#-(300/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G5#-#G4#)))+(((#Range#>(400/(#NumOfColors#-1)))&&(#Range#<=(500/(#NumOfColors#-1))))*(#G5#+((#Range#-(400/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G6#-#G5#)))+(((#Range#>(500/(#NumOfColors#-1)))&&(#Range#<=(600/(#NumOfColors#-1))))*(#G6#+((#Range#-(500/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G7#-#G6#)))+(((#Range#>(600/(#NumOfColors#-1)))&&(#Range#<=(700/(#NumOfColors#-1))))*(#G7#+((#Range#-(600/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G8#-#G7#)))+(((#Range#>(700/(#NumOfColors#-1)))&&(#Range#<=(800/(#NumOfColors#-1))))*(#G8#+((#Range#-(700/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G9#-#G8#)))+(((#Range#>(800/(#NumOfColors#-1)))&&(#Range#<=(900/(#NumOfColors#-1))))*(#G9#+((#Range#-(800/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#G10#-#G9#)))),(((#Range#<=(100/(#NumOfColors#-1)))*(#B1#+(#Range#/(100/(#NumOfColors#-1)))*(#B2#-#B1#)))+(((#Range#>(100/(#NumOfColors#-1)))&&(#Range#<=(200/(#NumOfColors#-1))))*(#B2#+((#Range#-(100/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B3#-#B2#)))+(((#Range#>(200/(#NumOfColors#-1)))&&(#Range#<=(300/(#NumOfColors#-1))))*(#B3#+((#Range#-(200/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B4#-#B3#)))+(((#Range#>(300/(#NumOfColors#-1)))&&(#Range#<=(400/(#NumOfColors#-1))))*(#B4#+((#Range#-(300/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B5#-#B4#)))+(((#Range#>(400/(#NumOfColors#-1)))&&(#Range#<=(500/(#NumOfColors#-1))))*(#B5#+((#Range#-(400/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B6#-#B5#)))+(((#Range#>(500/(#NumOfColors#-1)))&&(#Range#<=(600/(#NumOfColors#-1))))*(#B6#+((#Range#-(500/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B7#-#B6#)))+(((#Range#>(600/(#NumOfColors#-1)))&&(#Range#<=(700/(#NumOfColors#-1))))*(#B7#+((#Range#-(600/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B8#-#B7#)))+(((#Range#>(700/(#NumOfColors#-1)))&&(#Range#<=(800/(#NumOfColors#-1))))*(#B8#+((#Range#-(700/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B9#-#B8#)))+(((#Range#>(800/(#NumOfColors#-1)))&&(#Range#<=(900/(#NumOfColors#-1))))*(#B9#+((#Range#-(800/(#NumOfColors#-1)))/(100/(#NumOfColors#-1)))*(#B10#-#B9#))))
X=0
Y=0
W=100
H=50
MouseScrollDownAction=[!SetVariable Range "(Clamp((#Range#-1),0,100))"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollUpAction=[!SetVariable Range "(Clamp((#Range#+1),0,100))"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
I took the decision to write colors as <ColorNumber>:<R>,<G>,<B>,<A>; in the string, instead of just <R>,<G>,<B>,<A>; since regex (or Rainmeter, inside a Substitute, for that matter) can't count and automatically setting everything would have required additional measures (still much fewer than in your approach though). My initial prediction was that I would need 3 measures, but with some minor changes in how a color is written I was able to do it in just a single measure.
By the way, your original code threw some errors in the log which I didn't notice previosly as the code worked; didn't bothered to see what's going on (it may even be that those "errors" are normal, considering your SolidColor formula), I was more interested in offering a shorter alternative... which is even shorter than my own previously posted code, if you can believe it...
P.S. While your code in my adapted form is indeed shorter, it still needs code modification when the number of colors change to more than 10. My previous implementation doesn't have this problem, like I said - it basically behaves like Lua by taking parameters and doing its job without interference.
You were saying ?! ...eclectic-tech wrote: ↑August 8th, 2020, 7:48 pm It's great to code as much as possible in native Rainmeter when it is practical. But I think the Blend Color script is the easiest way to control blending colors, and controlling transparency, using a single measure.