0.3.3 • Published 5 months ago

sexy-qr v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Sexy-QR

Sexy SVG QR-code generator

[ >> Online demo << ]

Install

npm install sexy-qr

API

QRCode

Options

FieldTypeDescription
contentstringQR encoded value
ecl'L' / 'M' / 'Q' / 'H'Error correction

Properties:

PropertyDescription
matrixMatrix array
sizeSide size of matrix

Methods:

MethodValuesDescription
emptyCenter(emptySize: number)Remove points in center

QRSvg

Options

FieldTypeDescription
fillstringSVG fill color
sizenumberSize of SVG in px
radiusFactornumberFactor of points corner radius (0-1)
cornerBlockRadiusFactornumberFactor of big squares corner radius (0-3)
cornerBlocksAsCirclesbooleanDraw big corner squares as circles
roundOuterCornersbooleanRound outer corners
roundInnerCornersbooleanRound inner corners
preContentstring / funcPre content of SVG code
postContentstring / funcPost content of SVG code

Properties

PropertyDescription
svgResult SVG code
pathsArray of path-strings
pointSizeSide size of one qr point

Usage

import { QRCode, QRSvg } from 'sexy-qr';

const svgCode = (() => {
  const qrCode = new QRCode({
    content: 'https://avin.github.io/sexy-qr',
    ecl: 'M', // 'L' | 'M' | 'Q' | 'H'
  });

  const qrSvg = new QRSvg(qrCode, {
    fill: '#182026',
    cornerBlocksAsCircles: true,
    size: 380, // px
    radiusFactor: 0.75, // 0-1
    cornerBlockRadiusFactor: 2, // 0-3
    roundOuterCorners: true,
    roundInnerCorners: true,
    preContent: '<!-- QR Code -->',
  });

  return qrSvg.svg;
})();

Demo

Example 1Example 2Example 3Example 4
PreviewPreviewPreviewPreview

License

MIT © avin

0.3.3

5 months ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago