Ranges and Markers
style.ranges is a list of coloured bands and live markers drawn on the track. Use a band to show a comfort zone or a danger zone, and a marker to show a second value, such as the room temperature next to the thermostat setting. An item with min and max is a band; an item with value is a marker.
type: custom:lcards-slider
entity: climate.living_room
preset: gauge-basic
control:
min: 10
max: 30
style:
gauge:
progress_bar:
height: 8 # a thin fill, so the bands show
align: end
ranges:
# three bands: cold, comfortable, hot
- min: 10
max: 17
color: var(--lcards-blue)
opacity: 0.5
- min: 17
max: 24
color: theme:colors.status.success
opacity: 0.5
- min: 24
max: 30
color: theme:colors.status.error
opacity: 0.5
# a marker at the room temperature, with a caption
- value: "{entity.attributes.current_temperature}"
color: var(--lcars-orange)
label:
text: NOWRange band fields
A band colours the stretch of the track between min and max. On a gauge it is a coloured block behind the scale; on pills it recolours the pills inside it; on a ring it colours that part of the ring, and on a shaped slider that part of the shape.
- Bands sit under the fill, so a full-height fill hides them. Use a thin fill (
style.gauge.progress_bar.height) or a lowopacityto keep them visible. minandmaxcan follow other entities, so a band can show a range that changes, such as a target set elsewhere.
type: custom:lcards-slider
entity: sensor.temperature
preset: gauge-basic
style:
track:
display:
min: -10
max: 40
unit: "°C"
gauge:
progress_bar:
height: 8
align: end
ranges:
- min: -10
max: 0
color: var(--lcards-blue)
- min: 30
max: 40
color: theme:colors.status.error
opacity: 0.6More about bands
- Templates:
minandmaxtake only the quick template kinds: tokens such as{entity.state},{entity.attributes.x},{states.domain.object_id.state},{datasource:name},{config.x},{variables.x}, and[[[JavaScript]]]. Jinja2 is not supported there, because positions are worked out again on every state change. - Scale:
minandmaxare measured on the scale the track shows (style.track.display), not on the range the slider sets.
| Key | Type | Default | Description |
|---|---|---|---|
min | number / string | required | Where the band starts: a number or a quick template |
max | number / string | required | Where the band ends, as min |
color | colour / object | - | Band colour; a state map works |
opacity | number | 0.3 on a gauge, 1 on a ring or shaped slider | Band opacity, 0 to 1. On pills it sets the pills' opacity inside the band; without it they keep their usual opacity |
Value marker fields
A marker points at one value on the track and moves when that value changes. On a gauge it is a triangle at the value; on pills the pill at the value is filled and outlined; on a ring it sits on the band. A shaped slider draws bands only, no markers.
- A marker's
colorcolours it on every look: the marked pill, or the gauge or ring marker.indicator.colorwins over it when both are set. - Defaults for every marker on the card go in
style.gauge.marker_indicator; a marker's ownindicatorkeys win.
type: custom:lcards-slider
entity: light.bedroom
preset: pills-left-border
style:
ranges:
# pills: the pill at 75 is filled with this colour and outlined
- value: 75
color: var(--lcars-orange)
pill_style:
stroke_color: var(--lcars-yellow)
stroke_width: 3type: custom:lcards-slider
entity: sensor.temperature
preset: gauge-basic
style:
track:
display:
min: -10
max: 40
unit: "°C"
ranges:
# gauge: a round marker at 20 and a line marker at 30
- value: 20
color: var(--lcars-yellow)
indicator:
type: round
size:
width: 12
- value: 30
color: theme:colors.status.error
indicator:
type: line
size:
width: 3
height: 24More about markers
- Templates:
valuetakes the same quick template kinds as a band'smin, so a marker can follow another entity's state or attribute. - On a ring: markers size themselves by type (
rounduseswidthonly),rotationis not used, andoffsettakesyonly, which moves the marker outward.
| Key | Type | Default | Description |
|---|---|---|---|
value | number / string | required | Where the marker sits: a number or a quick template, as a band's min |
color | colour / object | pills: var(--lcars-text-light), gauge and ring: marker_indicator.color, else the theme | The marker's colour; a state map works |
indicator.type | string | triangle (line on a ring) | line, round or triangle |
indicator.align | string | start | Where across the track: start, center or end. On a ring: start for line, end for triangle, center for round |
indicator.color | colour / object | the marker's color | Wins over color |
indicator.size.width | number | 20 | Width, px |
indicator.size.height | number | 20 | Height, px |
indicator.rotation | number | 180 | Turn, degrees (not on a ring) |
indicator.offset.x | number | 0 (20 on picard-gauge-vertical) | Nudge right, px |
indicator.offset.y | number | 10 on a flat gauge (20 with the left-border gauge presets), else 0 | Nudge down, px (on a ring: outward) |
indicator.border.enabled | boolean | false | Outline the marker |
indicator.border.color | colour / object | theme | Outline colour |
indicator.border.width | number | 1 | Outline width, px |
pill_style.stroke | boolean | true | Pills: outline the marked pill |
pill_style.stroke_width | number | 2 | Pills: outline width, px |
pill_style.stroke_color | colour / object | the marker's color | Pills: outline colour |
Label fields
A label is a caption on a marker, such as NOW or TARGET, or the value itself. It sits beside the marker on a gauge, beside the marked pill on pills, and outside the scale on a ring. Nothing shows unless label.text is set.
- On a flat track the caption sits above the marker, or below it when the card has no room above (a flat gauge's marker is at the top of the track). On an upright track it sits beside the marker.
- Captions don't move out of the way of tick labels, the value text or each other: use
offsetto place one exactly.
type: custom:lcards-slider
entity: sensor.temperature
preset: gauge-basic
style:
track:
display:
min: -10
max: 40
unit: "°C"
ranges:
- value: 25
color: var(--lcars-orange)
label:
text: TARGET 25
color: var(--lcars-orange)
font_size: 16
offset:
x: 50 # right of the marker
"y": 16 # level with the markerMore about labels
- Templates:
label.texttakes every template kind, Jinja2 and data sources included, unlike a marker'svalue. - Offsets replace the default spot: setting
offset.yon a flat track (oroffset.xon an upright one) replaces the default distance from the marker, so the number you give is measured from the marker itself.
| Key | Type | Default | Description |
|---|---|---|---|
label.text | string | - | The caption: any template, Jinja2 and data sources included |
label.color | colour / object | theme | Caption colour; a state map works |
label.font_size | number | 14 (12 on a ring) | Size, px |
label.offset.x | number | beside the marker | Nudge sideways, px |
label.offset.y | number | above the marker (below when there is no room) | Nudge down, px |