Setting a color to a variable then changing it after does not work?

Hi! I am trying to change all colors the are set to red to a color green. So I tried to create a global variable to make it easier since I have too far many components that are using this color.

Screenshot 2025-03-09 at 00.58.40

It did worked when I changed it to red when the screen initialised, but once I used it during if statements inside the ClockTimer, it does not work anymore

Screenshot 2025-03-09 at 00.51.39

an example of my block using this color

Im using KevinKunEnhance if that's important, thank you!

I do not see you changing the text color inside the Timer event?
You only set a global variable...

Taifun

Thank for the reply, what should I do to change it? I thought setting the value of redToGreen to the value of green/red would change its color. Thanks!

Well, for example put this into your Timer event

Taifun

I wanted all components that are using the color green, to use the color red (they are different types of components). Thanks again

Create lists for all the components (one list for each type of component) that you want to change color for, then iterate through each list and use Any Component blocks to change color.

Lists of components:

Setting color (add these inside the if conditions in the Clock.Timer event):

Hi! Thanks for your reply but this is the one I tried first but I want it to be much efficient, does that mean the one I'm trying will not work?

It might be possible with some constraints.
Do all of the components you want to change the color of belong to a single container (such as a HorizontalArrangement or VerticalArrangement)?

Show your full blocks under the triggering event so as to help you better.

Thanks to Kevinkun's amazing CompCreator extension, this works for any container, including the Screen itself (passed through the "in" parameter in the ListComponents block):

Note that this only works for attributes common to every component type in "component_types".

1 Like

Thanks, this worked after putting all my components that are using the color green in a procedure block and then calling that block in the timer event. Made changing color wayyy easier.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.