Color stops let a visible color follow a numeric value or a named state. The same idea can be used by Horseshoes, shapes, entity tools, and Sparkline graphs, so one familiar color scale can be reused throughout a card.
This page shows how to define numeric and state-based colors, choose between fixed ranges and smooth transitions, and reuse the same color stops in several places.
entities:-entity:sensor.temperature# Entity used by this examplelayout:rectangles:-xpos:50# Horizontal center of the Rectangleypos:50# Vertical center of the Rectanglewidth:50# Rectangle width in card coordinatesheight:24# Rectangle height in card coordinatesentity_index:0# Use the first entity configured abovecolor_stops:colors:-value:0# Start this color range at value 0color:"#42a5f5"-value:20# Start this color range at value 20color:"#66bb6a"-value:30# Start this color range at value 30color:"#f9a825"-value:40# Start this color range at value 40color:"#d32f2f"
entities:-entity:sensor.temperature# Entity used by this examplelayout:rectangles:-xpos:50# Horizontal center of the Rectangleypos:50# Vertical center of the Rectanglewidth:50# Rectangle width in card coordinatesheight:24# Rectangle height in card coordinatesentity_index:0# Use the first entity configured abovecolor_stops:colors:-state:low# Use this color when the state is lowcolor:"#66bb6a"rank:0# Order of this named state in the visual scale-state:moderate# Use this color when the state is moderatecolor:"#f9a825"rank:1# Order of this named state in the visual scale-state:high# Use this color when the state is highcolor:"#d32f2f"rank:2# Order of this named state in the visual scale
rank gives ordered displays a consistent level order.
entities:-entity:sensor.example_1# Entity used by this examplelayout:rectangles:-entity_index:0# Use entity 0 from entities: (0 = first entity)xpos:50# Horizontal position; 50 = center of the cardypos:50# Vertical position; 50 = center of the cardwidth:40# Width in card coordinatesheight:20# Height in card coordinatesshow:item_style:colorstop# Use the colorstop appearance/color modecolor_stops:colors:0:green50:orange100:red
The tool page shows which paint block controls fill and/or stroke for that item.
entities:-entity:sensor.temperature# Entity used by this examplelayout:rectangles:-xpos:50# Horizontal center of the Rectangleypos:50# Vertical center of the Rectanglewidth:50# Rectangle width in card coordinatesheight:24# Rectangle height in card coordinatesentity_index:0# Use the first entity configured aboveshow:item_style:colorstopinterpolated# Use the colorstopinterpolated appearance/color modecolorstopinterpolated:fill:true# Apply the selected color to the fillstroke:false# Do not apply the calculated color to the stroke
Segmented colors normally touch each other. If adjacent ranges visually run together, use gap to put a clear break between them; 0 leaves them touching and larger positive values add more space.
entities:-entity:sensor.example# Entity displayed by this Horseshoelayout:horseshoes:-entity_index:0# Use the first entity configured abovehorseshoe_scale:{}# Required scale block; uses the default 0–100 linear scalexpos:50# Horizontal center of the Horseshoeypos:50# Vertical center of the Horseshoeshow:horseshoe_style:colorstopsegments# Draw the configured color ranges as separate segmentscolor_stops:gap:2# Space between the colored segmentscolors:-value:0# Start this color range at value 0color:green# Color used for this value or state-value:50# Start this color range at value 50color:orange# Color used for this value or state-value:100# Start this color range at value 100color:red# Color used for this value or state
entities:-entity:sensor.temperature# Entity used by this examplelayout:rectangles:-xpos:50# Horizontal center of the Rectangleypos:50# Vertical center of the Rectanglewidth:50# Rectangle width in card coordinatesheight:24# Rectangle height in card coordinatesentity_index:0# Use the first entity configured above# Use different colors for Home Assistant light and dark mode.color_stops:modes:light:0:green# Light-mode color at the low end100:red# Light-mode color at the high enddark:0:"#4ade80"# Dark-mode color at the low end100:"#f87171"# Dark-mode color at the high end
Put the stop list directly under modes.light and modes.dark. Do not add another colors: level inside those mode blocks. If the active mode has no entry, the normal color_stops.colors list is used instead.
Add scales.default.min and scales.default.max when the color definition should also provide its numeric range. A Horseshoe uses this range as the default for omitted horseshoe_scale.min/max; explicit Horseshoe scale values still win. Real-time Bar and Equalizer Sparklines can also use this range for their current-value scale.
entities:-entity:sensor.temperature# Entity whose value uses this color scalelayout:horseshoes:-entity_index:0# Use the first entity configured abovehorseshoe_scale:{}# Use the default min/max supplied by color_stopscolor_stops:scales:default:min:0# Low end of the shared numeric scalemax:40# High end of the shared numeric scalecolors:0:"#42a5f5"20:"#66bb6a"40:"#d32f2f"
The explicit colors: list used elsewhere on this page can carry extra fields such as state, rank, and label. For simple numeric stops, the card also accepts a compact mapping such as colors: {0: blue, 20: green, 40: red} or a top-level compact color_stops mapping. These forms produce the same ordered numeric stops; use the explicit list when each stop needs extra metadata.
fhs_user_templates:templates:temperature_colors:template:type:color_stopscolor_stops:colors:-value:0# Start this color range at value 0color:"#42a5f5"-value:20# Start this color range at value 20color:"#66bb6a"-value:30# Start this color range at value 30color:"#f9a825"-value:40# Start this color range at value 40color:"#d32f2f"
entities:-entity:sensor.temperature# Entity used by this examplelayout:rectangles:-xpos:50# Horizontal center of the Rectangleypos:50# Vertical center of the Rectanglewidth:50# Rectangle width in card coordinatesheight:24# Rectangle height in card coordinatesentity_index:0# Use the first entity configured abovecolor_stops:template:name:temperature_colors# Name used for this template or supplied value