Socket
Socket
Sign inDemoInstall

sexy-qr

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sexy-qr

Sexy SVG QR-code generator


Version published
Weekly downloads
19
increased by18.75%
Maintainers
1
Install size
467 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 04 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc