Dynamic color based on entity state value (background / continuous scale)

Hey friends.
I want to present a set of sensor readings with continuous color scale. Most cards I looked at only support binned colors.

Any idea how I could build a view similar to this quick example from Excel?

(Context: My water tank is equipped with 11 temperature sensors to better understand the energy stored)

Depends on a source data - are they static or dynamic, do they belong to different sensors or to one sensor, etc.
A similar look may be achieved by Markdown card (support tables) and a custom flex-table-card (find it’s Docs and the main thread in Community for examples).

These are 11 independent sensors from an ESPHome device. Key challenge is that I want each individual value to be shown with a background color from a continuous color scale ranging from blue to red.
Both markdown card as well as flex-table-card do not directly support continuous color scales, as far as I am aware.

For both Markdown and flex-table-card, you can use card-mod to set a color dynamically dependently on a value.

Are you looking to do something like this?

(This doesn’t only work for badges. I use them in entity and other cards too. It uses linear RGB interpolation.)

1 Like

Quick note that that with card_mod v4, badges no longer need mod-card and can be styled directly with card_mod.

I saw that — that’s awesome. I need to find the time to upgrade my HA and card-mod. :slight_smile: I’ll update my post accordingly when that’s done.

1 Like