Repository navigation
How to change button's background between two colour? #4471
Replies: 3 comments 1 reply
|
There's several ways you can do this, for example if you're using Steps then you can use the Expression function Alternatively you could use a local variable, for example make a local variable called |
|
Try the local-variable method on the same button:
The local value should flip on every press, so the expression alternates between black ( |
|
thank you!I'm fix it already,thank you very much~
At 2026-11-04 01:38:00, "Vaibhav Soni" ***@***.***> wrote:
Try the local-variable method on the same button:
In the button’s Local Variables tab, create a user value named bg and set its initial value to true.
In the button’s Press Actions, add Internal: Local Variable: Set value and target bg.
Switch that action’s value field to Expression and enter:
!$(local:bg)
In Style, select the button’s Background element. Switch its fill-color field to Expression and enter:
$(local:bg) ? 0 : 0xff0000
The local value should flip on every press, so the expression alternates between black (0) and red (0xff0000). Make sure bg is local to this same button, and that both fields are in Expression mode. Companion’s [button styling guide](https://github.com/bitfocus/companion/blob/main/docs/user-guide/3_config/buttons/creating/button-styling/index.md) explains where to set the background color and use expressions.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|

Uh oh!
There was an error while loading. Please reload this page.
Is this a feature relevant to companion itself, and not a specific module?
Is there an existing issue for this?
Describe the feature
For example:press→black,press again→red,press again→black,change between two colour?
Usecases
No response
All reactions