Forum Academy Marketplace Showcase Pricing Features

Need help changing a text color every "x" seconds

Hey there!

I know it might be a newbie question for the community but I am still unclear about how I can change a text state to change color automatically (Based on hex codes) let’s say every 5 seconds. I’ve read a lot of posts on the forum and they are all associated with changing states when there’s some kind of action (Ex: A button is clicked) - I am just looking specifically for a solution where it changes automatically to a limited set of colors, let’s say 6 color hex codes and every color displayed after 5 secs.

Thanks :slight_smile:

You can run a ‘Do Every x Seconds’ workflow to set the state value, then set the text colour to that state value.

Here’s a simple way to do it (no doubt there are other ways as well)…

First, create an option set containing your colours, including an attribute (text) for the hex code, and a Number for the colour order (call it something like ‘Text Colour Option’):

e.g.
(Red, #F01D1D, 1); (Blue, #1D36F0, 2), and so on…

Create a custom state somewhere on your page (called something like ‘Text Colour’) of the type ‘Text Colour Option’ (the option set you’ve just created for your colours). Set the default value to be the first colour in the option set.

Set the colour of your text to a dynamic value, that being the custom state (Text Colour)'s hex code.

Then run a ‘Do Every x Seconds’ workflow to set the ‘Text Colour’ custom state value to:
get all Text Colour Options: filtered: This Text Colour Option's Number-1 is Custom State Text Colour's Number: first item

(In other words, you’re setting the custom state value to be the next colour in your list of colours.)

That’s all there is to it :slight_smile:

P.S. if you’re wondering how or why it will cycle back to the first colour in the option set once it reaches the end, it’s simply because it will be unable to find a colour that matches the filter constraint on the final colour, and so instead will revert to the default value which you set for the custom state, i.e. the first colour in the option set. Then it will cycle through again).

1 Like

Hello Adam,

Thanks for your response!

This is where I am kind of stuck right now See Attached I am not sure how to carry on “This Text Colour Option’s Number-1 is Custom State Text Colour’s Number” this statement.

I really appreciate your help!

*Forgot to attach
Uploading: Screen Shot 2021-10-15 at 7.38.29 PM.png…

I can’t see the screenshot (it doesn’t seem to have uploaded), so I’m not sure exactly what problem you’re having…

But you just need to set that in the workflow as the custom state value:

1 Like

Thanks a lot Adam for your contribution, your solution worked perfectly for me!

1 Like