SOLVED: Changing Text Color Multiple Times on Click

Hi,

I’m using custom states to change the background color when specific text is clicked. I was able to do that successfully, so now when a user clicks the text, the background color changes to green. The problem I’m having is that I would like the text background to change back to white if the user clicks the text again, and then back to green if it’s clicked a third time. I haven’t figured out how to do this.

Any help would be appreciated! I’ve spent a few hours reading similar posts, but haven’t been able to figure this out.


Hello,

Do you want to only loop through 2 colors? If so, that’s pretty simple. You won’t even need to have a text state, you could achieve it by simply having a yes/no state

Note: You could change these values if you want.

Let’s say yes would show white and no would show green

Since you said white would be the first color, your yes/no state should have a default value of
yes

Now, in your text element, you would need to add a condition where if state’s value is yes, its font color should be white. Similarly, add a different condition where if state’s value is no its font color should be green.

Let’s hop to the workflows to make it work!

You would need to have 2 workflows for this one.

One for when text is clicked and text’s state is yes and one for when text is clicked and text’s state is no

For the former, simply have an action to set state of the text to no. And do the same for the latter workflow but set its state to yes

Hope this helps!

Best,
Nino

1 Like

use states just like you are.

the text has custom state of "change color? yes/no

on page load, its one color

when you click the text, it changed the "change color? to yes.

on the text element itself, you put a condition that is “when change color is yes, be green”

worflow for clicking text is 2 workflows
when “change color?” is no, set state to “change color?” yes
when “change color?” is yes, set state to “change color?” no

jinx!, except you posted while i was typing

1 Like

Saw you typing as well haha!

I thought if @ksplinter007 finishes first, I would have to delete everything that I was typing which I found more tiring than completing the rest of the instruction so I typed like crazy haha :laughing:

Thanks very much! This worked. I realized you had to create two separate workflows.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.