EQRCode.SVG (EQRCode v0.1.10) View Source

Render the QR Code matrix in SVG format

Link to this section Summary

Functions

Returns the SVG format of the QR Code.

Link to this section Functions

Specs

svg(EQRCode.Matrix.t(), map() | Keyword.t()) :: String.t()

Returns the SVG format of the QR Code.

Options

You can specify the following attributes of the QR code:

  • :background_color - In hexadecimal format or :transparent. The default is #FFF

  • :color - In hexadecimal format. The default is #000

  • :shape - Only square or circle. The default is square

  • :width - The width of the QR code in pixel. Without the width attribute, the QR code size will be dynamically generated based on the input string.

  • :viewbox - When set to true, the SVG element will specify its height and width using viewBox, instead of explicit height and width tags.

Default options are [color: "#000", shape: "square", background_color: "#FFF"].

Examples

qr_code_content
|> EQRCode.encode()
|> EQRCode.svg(color: "#cc6600", shape: "circle", width: 300)