JSPM

  • Created
  • Published
  • Downloads 180933
  • Score
    100M100P100Q169887F
  • License MIT

Add a style and an image to your QR code

Package Exports

  • qr-code-styling

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qr-code-styling) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

QR Code Styling

JavaScript library for generating QR codes with a logo and styling.

Examples

Installation

npm install qr-code-styling

Ussage

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../lib/qr-code-styling.js"></script>
</head>
<body>
    <div id="canvas"></div>
    <script type="text/javascript">

        const qrCode = new QrCodeStyling({
            width: 300,
            height: 300,
            data: "https://www.facebook.com/",
            image: "./assets/fb_logo.png",
            dotsOptions: {
                colour: "#4267b2",
                type: "rounded"
            },
            backgroundOptions: {
                colour: "#e9ebee",
            }
        });

        qrCode.append("#canvas");
    </script>
</body>
</html>

API

options type required default value
width number 300
height number 300
data string true
image string
qrOptions.typeNumber number (0 - 40) 0
qrOptions.mode string ('Numeric' 'Alphanumeric' 'Byte' 'Kanji')
qrOptions.errorCorrectionLevel string ('L' 'M' 'Q' 'H') 'L'
imageOptions.hideBackgroundDots boolean true
imageOptions.imageSize number 0.4
dotsOptions.colour string '#000'
dotsOptions.type string (`'rounded' 'dots' 'default') 'default'
backgroundOptions.colour string '#fff'

License

MIT