Changing background colour by tapping on button

Is it possible to click on a button and then it changes it’s colour e.g. to green (with a underlying animation to highlight the button) for a few seconds and then set it back to the initial value?

Sure, you can do it. Check out this tutorial: https://docs.appgyver.com/appgyver-academy/tutorials/tutorial-articles/button-with-loading-indicator In your case, you’d just use variable that is bound to button colour rather than visibility as the tutorial does.

So, 1. Set variable that’s bound to button colour 2. Delay 3. Set variable that’s bound to button colour

1 Like

I did exactly what you’ve said, and it worked. But the starting color is not right.
These are the variables i’ve created. I’ve set the example value to #4E4E4E.


And this is the formula:

There it says the preview value is #4E4E4E and i also can’t change anything there.
But in the preview version it is only showing a blue button. How can i change this? It should be a dark grey button…

You have only added an example value. That’s not a real value in the app, but rather makes you see possibilities in Composer. You need to give it real value as initial value. Adding initial value can be done form the gear icon on right:

(You could also use Set page variable Flow function, but initial value is much better and simpler in this case.)

1 Like