Skip to main content

canvas

canvas() -> content 

Sets up a canvas for drawing on.

length:

Default: 1cm

Used to specify what 1 coordinate unit is. If given a ratio, that ratio is relative to the containing elements width!

body:

A code block in which functions from the draw module have been called.

background:

Default: none

A color to be used for the background of the canvas.

padding:

Default: none

How much padding to add to the canvas. none applies no padding. A number applies padding to all sides equally. A dictionary applies padding following Typst's pad function: https://typst.app/docs/reference/layout/pad/. An array follows CSS like padding: (y, x), (top, x, bottom) or (top, right, bottom, left).

debug:

Default: false

Shows the bounding boxes of each element when true.