Template in tile setup gives yaml error, but ok in template editor

I want to dynamically set a color in my dashboard tile.
entering the color directly works.
Using a template gives yaml error while in template editor gives the expected results



Can you post the actual contents of your template - rather than just a screen shot. This may assist people in diagnosing the issue.

1 Like

I don’t think the tile-card supports templating, you have to choose from the predefined list of colours.

 color string (Optional, default: state)

Set the color when the entity is active. By default, the color is based on state, domain, and device_class of your entity. It accepts color token or hex color code.

1 Like

Thanks for your prompt reply.
I discard the template and use two tile-cards and enable visibility based on the numeric value.