Polygon¶
A polygon adds a triangle, hexagon, or another many-sided shape anywhere on the card. Use it as a background, border, status surface, or as the matching background for a polygon-shaped horseshoe.
Basic configuration¶
Add polygons under layout.polygons. Choose the number of sides, width, and height:
An odd-sided polygon points upward by default. An even-sided polygon has a horizontal side at the top.
Choose the size and corners¶
width and height set the outside dimensions. Use equal values for an evenly proportioned polygon, or different values when the shape must fit a wider or taller area:
Add radius to round the corners. Its meaning is the same as for a rectangle; omit it for sharp corners.
Choose what faces upward¶
Corner numbers increase clockwise. A decimal identifies a point along the side leading to the next corner:
top places one of these positions at the top of the shape:
| Value | Result |
|---|---|
top: 0 | Corner 0 faces upward. |
top: 0.5 | The middle of the side from 0 to 1 faces upward. |
top: 0.1 | The point ten percent along the side from 0 to 1 faces upward. |
This example turns a hexagon until corner 0 is at the top:
Match a polygon horseshoe¶
A polygon and a polygon-shaped horseshoe match exactly when their position, size, number of sides, and top value are equal. This lets you place a filled surface behind a gauge:
See Horseshoe path shapes for partial polygon gauges and direction settings.
Configuration options¶
| Field | Required | Default | Description |
|---|---|---|---|
xpos | Yes | Horizontal center position. | |
ypos | Yes | Vertical center position. | |
sides | Yes | Number of sides; use an integer of 3 or greater. | |
width | Yes | Exact outer width. | |
height | Yes | Exact outer height. | |
radius | No | 0 | Corner radius; use 0 for sharp corners. |
top | No | 0 for odd sides; 0.5 for even sides | Side position that faces upward. |
fill_mask | No | auto | Fill width removed along the inside of the outline. |
entity_index | No | Not set | Entity used for value-dependent colors, actions, and animations. |
styles | No | Default polygon style | Fill, outline, opacity, and other SVG styles. |
color_stops | No | Not set | Colors the polygon from its entity value. |
Styling and interaction¶
Polygons support the same fill and outline styles as rectangles. When both are translucent, fill_mask: auto prevents their colors from becoming darker where they meet.
Connect a polygon through entity_index when its color or behavior should follow an entity. Continue with Color stops, Color filters, Actions, and Animations.
The complete polygon and horseshoe example combines a filled polygon, a matching gauge, a state, and a slider.