How do I make text color equal entity state color?

I have searched for a solution here but all I am finding is how to manually set the color of text based on the entity state through script using card_mod. I am trying to make it so the color of the text equals the color of the entity state color. For instance. With the mushroom light card you can have the icon match the color of the light through a setting in the graphical UI editor. I would like to do the same with the text but I do not know the proper syntax.

Welcome!

Check out this guide for Mushroom Cards

Post your code and questions here

A good read when joining the forum