Day and night¶
The Day and night layer adds daylight and nighttime information to a Sparkline. The card uses Home Assistant's sun.sun times and aligns them with the same history period as the graph, which makes daily patterns easier to relate to sunrise and sunset.
This page shows how to use day/night as a graph background or separate band/ring and how to position and style that layer.
Show day and night behind the graph¶
Use the background mode when daylight context should sit behind the data without taking extra graph space.
Show a separate day/night band¶
Use a band when day/night information should remain visually separate from the data itself.
Move or resize the band¶
Use:
positionfor top/bottom on Cartesian graphs;sizefor band/ring thickness;offsetto move it inward or outward.
Choose the history period¶
A calendar period is useful when the graph should follow complete days, including today's sunrise and sunset. A rolling window shows the recorded day/night sections inside a moving range.
Configuration options¶
Required applies to the specific form described by that table: Yes means you need the field for that form; No means you can leave it out. Not set means the card adds no explicit value when the option is omitted.
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
sparkline.show.day_night | boolean | No | false | Shows the day/night layer. |
sparkline.day_night.mode | background, band | No | background | background shades day/night behind the graph; band draws a separate day/night band or radial ring. |
sparkline.day_night.position | top, bottom | No | bottom | Places a Cartesian day/night band above or below the graph. |
sparkline.day_night.size | number | No | 4 | Band/ring thickness. |
sparkline.day_night.offset | number | No | 0 | Positive moves the band/ring outward; negative inward. |
sparkline.day_night.day.styles | mapping | No | Transparent | Day appearance. |
sparkline.day_night.night.styles | mapping | No | Theme divider color | Night appearance. |