Skip to content

How to change button's background between two colour? #4470

Closed

Description

@WUjiaoxing1

Is this a feature relevant to companion itself, and not a specific module?

  • I believe this to be a feature for companion, and is not specific to a module

Is there an existing issue for this?

  • I have searched for similiar existing issues

Describe the feature

For example:press→black,press again→red,press again→black,change between two colour?

Usecases

No response

Activity

  1. thedist commented on Sep 18, 2026

    @thedist
    Member

    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.

  2. locked and limited conversation to collaborators on Sep 18, 2026
  3. converted this issue into a discussion #4471 on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions