Giter VIP home page Giter VIP logo

sexy-qr's Introduction

Sexy-QR

Sexy SVG QR-code generator

[ >> Online demo << ]

Install

npm install sexy-qr

API

QRCode

Options

Field Type Description
content string QR encoded value
ecl 'L' / 'M' / 'Q' / 'H' Error correction

Properties:

Property Description
matrix Matrix array
size Side size of matrix

Methods:

Method Values Description
emptyCenter (emptySize: number) Remove points in center

QRSvg

Options

Field Type Description
fill string SVG fill color
size number Size of SVG in px
radiusFactor number Factor of points corner radius (0-1)
cornerBlockRadiusFactor number Factor of big squares corner radius (0-3)
cornerBlocksAsCircles boolean Draw big corner squares as circles
roundOuterCorners boolean Round outer corners
roundInnerCorners boolean Round inner corners
preContent string / func Pre content of SVG code
postContent string / func Post content of SVG code

Properties

Property Description
svg Result SVG code
paths Array of path-strings
pointSize Side 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 1 Example 2 Example 3 Example 4
Preview Preview Preview Preview

License

MIT © avin

sexy-qr's People

Contributors

avin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.