polygon
ElementElementElement functions can be customized with set
and show
rules.
set
and show
rules.A closed polygon.
The polygon is defined by its corner points and is closed automatically.
Example
#polygon(
fill: blue.lighten(80%),
stroke: blue,
(20%, 0pt),
(60%, 0pt),
(80%, 2cm),
(0%, 2cm),
)

ParameterParameterParameters are input values for functions. Specify them in parentheses after the function name.
fill
How to fill the polygon.
When setting a fill, the default stroke disappears. To create a rectangle with both fill and stroke, you have to configure both.
Default value: none
fill-rule
SettableSettableSettable parameters can be set using the set
rule, changing the default value used thereafter.
set
rule, changing the default value used thereafter.The drawing rule used to fill the polygon.
See the curve documentation for an example.
Available string values:
non-zero
Specifies that "inside" is computed by a non-zero sum of signed edge crossings.
even-odd
Specifies that "inside" is computed by an odd number of edge crossings.
Default value: "non-zero"
stroke
How to stroke the polygon.
Can be set to none
to disable the stroke or to auto
for a
stroke of 1pt
black if and only if no fill is given.
Default value: auto
vertices
RequiredRequiredRequired parameters must be specified when calling the function.PositionalPositionalPositional parameters can be set by specifying them in order, omitting the parameter name.VariadicVariadicVariadic parameters can be specified multiple times.
The vertices of the polygon. Each point is specified as an array of two relative lengths.
DefinitionDefinitionThese functions and types can have related definitions. To access a definition, specify the name of the function or type, followed by the definition name separated by a period.
regular
A regular polygon, defined by its size and number of vertices.
Show example
#polygon.regular(
fill: blue.lighten(80%),
stroke: blue,
size: 30pt,
vertices: 3,
)

fill
How to fill the polygon. See the general polygon's documentation for more details.
stroke
How to stroke the polygon. See the general polygon's documentation for more details.