You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to change button's background between two colour? #4470
There's several ways you can do this, for example if you're using Steps then you can use the Expression function $(this:step) === 1 ? 0 : 0xff0000 for the background fill colour of a button, which if the step is 1 then it'll be a black background, otherwise it'd be red.
Alternatively you could use a local variable, for example make a local variable called bg, set it to use JSON mode rather than text and a value of true, then put the internal: Local Variable: Set value action on then button that's targeting bg, and the value is !$(local:bg) which will just flip the value between true/false, then the background fill can be set to $(local:bg) ? 0 : 0xff0000.
Activity
thedist commentedon Sep 18, 2026
There's several ways you can do this, for example if you're using Steps then you can use the Expression function
$(this:step) === 1 ? 0 : 0xff0000for the background fill colour of a button, which if the step is 1 then it'll be a black background, otherwise it'd be red.Alternatively you could use a local variable, for example make a local variable called
bg, set it to use JSON mode rather than text and a value oftrue, then put the internal: Local Variable: Set value action on then button that's targetingbg, and the value is!$(local:bg)which will just flip the value between true/false, then the background fill can be set to$(local:bg) ? 0 : 0xff0000.