Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

How do you turn a button into a different colour when its pressed?



I've added a button, what I want it to do is simply toggle between true and false and have it change colour to indicate that when pressed.


How do you do that?


Thank you - that’s a useful example with the timer, however think you missunderstood my request.


what I meant was that in your original example, it’s a toggle, so only swaps between two colours each time button is pressed. What I want is that on first click it goes amber, second click red, third click back to green. But remains each colour until clicked, not a cycle through all colours in one go. So having items that can have 3 states rather than just simple true or false.

Community Champion
Community Champion

Hi @JC75


Yup, looks like my understanding for English still needs more improvement.

(Maybe I always used to translate in my mind into Chinese when reading).


The best and most useful syntax used in PowerApps;

- UpdateContext

- x = x+1 (widely used in any programming languages for Looping purposes

- Switch (If is another alternative, but longer codes)


Here it is the final sample and hope this time I have understood your messages.


Loop, with unlimited Click; change as you wish!Loop, with unlimited Click; change as you wish!


Have a nice day.

Good nite.


View solution in original post

That’s perfect thank you 

@hpkeong wrote:



Each button has many variable for you to control:

- PressedFill

- PressedColor

You can make changes over the color as you wish.



where am i supposed to do this? please help, im a noob in powerapps

@hpkeong I can't see what I'm doing wrong. But it looks like Switch isn't working. The color does not change.


For anyone else having an issue, I found another solution that works great




Did they change anything in this few years? 


When i wanna do "UpdateContext({x: x+1});"


im getting syntax error.


Btw why everyone post images with code instead of copy it here?....


Thanks for answers.

@Corbie your syntax error would be helpful 🙂




Sry i figure it out.


it was cause of different language in browser.


Thanks for answer anyway.



My colours are not updating. Is that because I am using a global variable instead of a context variable? Context variable is too limited as I want to pass this value between screens.

    If(daySelected = 2, Color.White, RGBA(255, 255, 255, 1))

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,182)