It is currently April 23rd, 2024, 8:43 am

fading trough 3 colors... how to do it?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7148
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

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]
balala wrote: August 9th, 2020, 11:46 am Alright, post the code if you're ready with it, please.
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
A single String measure and its regex substitute create all the bangs needed to set all the variables, before using them in the meter's SolidColor option (which I did NOT touch, except when converting your [MeasureNumOfColors] into a #NumOfColors# variable, so as to avoid yet another measure for that). I guess even this option can be "stringified" automatically, if needed... :sly:

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... :lol:

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.
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.
You were saying ?! ... :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7148
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

jsmorley wrote: August 9th, 2020, 2:23 pm Yincognito,

I'm not in any way suggesting that jumping to Lua is a better way to attack "transitioning" between two colors in Rainmeter. The math involved in properly and logically altering hue/saturation/brightness, while not rocket science, is no less complicated than logically altering red/green/blue to achieve the result of fading between say 227,32,0 and 0,159,6. In fact maybe in some ways it is more complicated, since the saturation and brightness are a "percentage" and are pretty easy to deal with, while "hue" is a number between 0 and 360 degrees, and takes a different approach than the other two. You in effect need to change the "hue" into a percentage difference between the starting and ending hue.

In either case, RGB or HSB, there are complexities with "how fast" you transition each of the components, in order to get a smooth, equal transition. For instance, going from 227,32,0 to 0,159,6, you are going to want to change the "red" in larger increments than you change the value for "green", so in effect they both arrive at the "destination" more or less at the same time.
Yes, that's true. Both variants (i.e. Lua and native Rainmeter code) do pretty much the same thing "behind the scenes". Having Lua is for sure excellent, like I said, assuming there is a more complex operation to do, and obviously having the "script snippet" already written by someone else is going to ease coding a lot for the regular user. If there isn't such a code already written, well, one would still have to write all the code himself (and not just the script measure, but also the script iself), whether it's in Lua or native code. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

Yincognito wrote: August 9th, 2020, 2:39 pm Yes, that's true. Both variants (i.e. Lua and native Rainmeter code) do pretty much the same thing "behind the scenes". Having Lua is for sure excellent, like I said, assuming there is a more complex operation to do, and obviously having the "script snippet" already written by someone else is going to ease coding a lot for the regular user. ;-)
Another thing I like about Lua is that it can remove the "all option values must be on the same line" restriction if you really want it to.

Skin:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[Lua]
Measure=Script
ScriptFile=Test.lua
Disabled=1

[MeterOne]
Meter=String
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello World
;LeftMouseUpAction=[!Log "1"][!Log "2"][!Log "3"][!Log "4"][!Log "5"]
LeftMouseUpAction=[&Lua:LogFive()]
Test.lua:

Code: Select all

function LogFive()

	SKIN:Bang('!Log', '1')
	SKIN:Bang('!Log', '2')
	SKIN:Bang('!Log', '3')
	SKIN:Bang('!Log', '4')
	SKIN:Bang('!Log', '5')

end
Or even:

Code: Select all

function LogFive()

	for i = 1, 5 do
		SKIN:Bang('!Log', i)
	end

end
Obviously a rudimentary and practically useless example, but you no doubt can see where I'm going with that.
User avatar
Yincognito
Rainmeter Sage
Posts: 7148
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

jsmorley wrote: August 9th, 2020, 2:52 pm Another thing I like about Lua is that it can remove the "all option values must be on the same line" restriction if you really want it to.
Yeah, I think I'm going to tackle Lua at some point, just to get some "moves" in it. I would still have to have some motivation to do it though, that's paramount in my case. By the way, can Lua set the desktop work area like Rainmeter does and keep it that way no matter what (e.g. moving the taskbar, changing screen resolution, etc)?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

Yincognito wrote: August 9th, 2020, 3:05 pm Yeah, I think I'm going to tackle Lua at some point, just to get some "moves" in it. I would still have to have some motivation to do it though, that's paramount in my case. By the way, can Lua set the desktop work area like Rainmeter does and keep it that way no matter what (e.g. moving the taskbar, changing screen resolution, etc)?
No, Lua knows nothing whatsoever about Windows.

Lua is a "platform agnostic" programming language that works equally well, and exactly the same, on Linux or Windows.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

I think you would need a Plugin, one that was constantly polling the DesktopWorkArea in Windows, to deal with that. Even then, it would be hard to deal with some "lag".
User avatar
Yincognito
Rainmeter Sage
Posts: 7148
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

jsmorley wrote: August 9th, 2020, 3:10 pm I think you would need a Plugin, one that was constantly polling the DesktopWorkArea in Windows, to deal with that. Even then, it would be hard to deal with some "lag".
I see. Thanks for the info though. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

To be perfectly honest, I really don't like the DesktopWorkArea functionality in Rainmeter. I could argue that any ability to "change" it never should have been included. That is a function that Windows really, really wants to own, and I've never been a fan of trying to override Windows in Rainmeter. The real point of it in Windows is to keep maximized "windows" from interfering with the placement of the Taskbar. So from Window's point of view, DesktopWorkArea = Screen - Taskbar. It's not really happy with anything else, and it doesn't care what anyone else thinks about it.

I can understand the charm of having a DesktopWork area that also keeps maximized windows from overlaying your skins, but I just don't think it can be made to work in a consistent and graceful way. You are going to have to be constantly "chasing" it, and in my view you can't stay up with it, only a bit behind.

I also don't want window overlaying my skins, and I don't allow it. However, I do that by sizing the programs I use to fit in the "area" I want Windows applications to live it. 99.9% of Windows applications will "remember" where you put them and how big they are. I just never, ever "maximize" anything.


1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

dvo wrote: August 9th, 2020, 3:46 pm wipe wan.. js or you have a vpn...
If you think the entire world can't see your IP address when you are on the internet, you are mistaken... ;-)

Like all reasonably modern setups, my actual computer is behind a DMZ and a firewall in my router. You are welcome to do your worst with my IP address. Have fun with that.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

dvo wrote: August 9th, 2020, 3:53 pm but give it on a silver platter is not the best way to show it :P
they learned me to fix things not to break things ..btw it's not in my nature to do so ...
Up to you. I just don't buy into the paranoia about things that just don't matter. So Google knows a lot about what I do and targets advertising to me. So? I'm going to get advertising in any case, I find it hard to care that Google knows I searched for an air conditioner last week, and I suddenly get ads for air conditioners. How does that hurt me?

I'm VERY careful about what I run and where I go with my computer, but after 30 years or so of experience with this, I have my own personal feelings about what matters and what doesn't. Every site you go to can have your IP address as a matter of course. You have to tell them, so you can get back "answers" to the packets you send.

Your IP address is not your Social Security number. The same care doesn't need to be taken with it.