It is currently September 29th, 2022, 6:38 pm

Decimal Color in condition

Get help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 394
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Decimal Color in condition

Post by StArL0rd84 »

I want to use a conditional calculation to to determine the color of a buttons current state. Normal, Hover and pressed. (1, 2 or 3)

ImageTint=(#ColorButtonState1# = 1 ? 255,0,0 : (#ColorButtonState1# = 2 ? 0,255,0 : 0,0,255)))

Is there any way I can use commas in the calculation? Parentheses? Escaping the commas?
User avatar
SilverAzide
Rainmeter Sage
Posts: 2049
Joined: March 23rd, 2015, 5:26 pm

Re: Decimal Color in condition

Post by SilverAzide »

StArL0rd84 wrote: September 13th, 2022, 3:56 pm I want to use a conditional calculation to to determine the color of a buttons current state. Normal, Hover and pressed. (1, 2 or 3)

ImageTint=(#ColorButtonState1# = 1 ? 255,0,0 : (#ColorButtonState1# = 2 ? 0,255,0 : 0,0,255)))

Is there any way I can use commas in the calculation? Parentheses? Escaping the commas?
I believe you need to do it color by color, not the entire expression. I mean, something like this:

Code: Select all

ImageTint=((#ColorButtonState1# = 1) ? 255 : 0),((#ColorButtonState1# = 2) ? 255 : 0),(((#ColorButtonState1# = 1) || (#ColorButtonState1# = 2)) ? 0 : 255)
; or maybe
ImageTint=((#ColorButtonState1# = 1) ? 255 : 0),((#ColorButtonState1# = 2) ? 255 : 0),((#ColorButtonState1# = 3) ? 255 : 0)
In other words:
ImageTint=((#ColorButtonState1# = 1) ? 255 : 0),((#ColorButtonState1# = 2) ? 255 : 0),((#ColorButtonState1# = 3) ? 255 : 0)
Gadgets Wiki GitHub More Gadgets...
User avatar
balala
Rainmeter Sage
Posts: 14566
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Decimal Color in condition

Post by balala »

StArL0rd84 wrote: September 13th, 2022, 3:56 pm Is there any way I can use commas in the calculation? Parentheses? Escaping the commas?
Right, SilverAzide is perfectly right, because a formula used anywhere in Rainmeter HAS TO BE entirely numeric. No strings allowed in formulas. A color code, even if is composed by three (or four) numbers, is a string in fact. This is why your approach doesn't work and have to use it as described above by SilverAzide.