I’ve been looking for a solution to OP’s question too, and am grateful for this explanation!
Now… I have lots of entities on many cards. Do I have to go and copy this formatting to every one of them separately? Is there no way to do it generically?
So, for example, I have an Entities card with a list of a dozen irrigation stations. I want any station that is currently active “on” to be highlighted a different color from the rest. So do I have to manually update each of the dozen entities to type:custom-entity-row and add the if/then/else to every one of them, one at a time?
Or is there any way to do it more programatically? Maybe someone knows of another card type (not Entities), that lets you give it one config to highlight the “on” entities in it? etc.
Thanks to OP for this suggestion, it solved my problem. To streamline the repetitiveness of the formatting code I used a call to the custom:decluttering-card passing (in my case) the entity and name of entity as variables. Worked just fine even from within a custom:fold-entity-row.