Help with Mushroom Template Card and Icon coloring

Hi guys,

First of all I wanted to excuse myself if I posted this in the wrong category. And second of all while I know this forum is not a support forum I would be very thankful for your help, tips or ideas.

I am pretty new to templating on the lovelace dashboard with with jinja. In my dashboard i am using Mushroom Template Cards.

What i am trying to accomplish is the following:

while switch = on:
color icon random (flashing) colors

i’ve tried something like the following:

{% set colors = ["orange", "red", "yellow", "green", "blue", "purple", "pink"] %}
{% for i in range(1,10) %}
  {% if is_state('switch.hue_smart_plug
', 'on') %}
    {{ colors | random }}
  {% endif %}
{% endfor %}

in the dev tools this seems to (at least kinda) work, but when i paste this in the color slot of my template card it stops to work properly.

I attached the dev tools results. Due to me being a new user i am unable to provide another screenshot of the dashboard icon. But the icon doesnt remain the usual grey is changes so a weird white icon with a tranparent looking background.

Thank you all for reading and maybe deciding to help me with this.

~Sincerely Frisco

Mushroom card for gate?. has some links to help you I believe.