A package for generating QR codes (based on the Rust crate fast_qr
).
Generates a QR code from the given data.
qr.create(
string | array | bytes,
format: string,
margin: number,
fill: color,
width: auto | relative length,,
height: auto | relative length,
alt: none | string,
fit: string,
) -> image
The data to encode into the QR code. If the data is too large to fit into a single QR code, this method will error.
The image format of the QR code.
"png"
: Raster image format."svg"
: Vector image format.
Default: "svg"
The the number of "units" between the QR code and the edge of the image.
Default: 4
The color of the QR code.
Default: black
The width of the QR code. This parameter is passed to the image
element.
Default: auto
The height of the QR code. This parameter is passed to the image
element.
Default: auto
The alternative text of the QR code. This parameter is passed to the image
element.
Default: none
How the QR code should adjust its size to fit a given area. This parameter is passed to the image
element.
"cover"
: The QR code shuold completely cover the area. This is the default."contain"
: The QR code should be fully contained in the area."stretch"
: The QR code should be stretched so that it fills the area, even if this means that the image will be distorted.
Default: "cover"
#import "@local/qr:0.1.0"
#table(
columns: 2,
[*Data*], [*QR Code*],
[Hello world!], qr.create("Hello world!", margin: 0, width: 100%),
[Hallo Welt!], qr.create("Hallo Welt!", fill: blue, width: 100%),
[#(1, 2, 3, 4)], box(fill: yellow, qr.create((1, 2, 3, 4), width: 100%)),
)