spr-qr-lib
v2.0.21
Published
QR Code generator
Downloads
2
Readme
SPR-QR
JavaScript library for generating SVG code of SPR-style QR codes.
Usage
npm
npm install spr-qr-lib
And use in your code
import qr from 'spr-qr-lib';
// Returns SVG code of generated 256x256 QR code with SPR logo
const qrSvg = qr.createQR('Text to encode', {
qrSize: 256,
isShowLogo: true
});
API Reference
Syntax
generatedSvgCode = Qr.createQR(text[, qrOptions]);
Parameters
text
required String to generate a QR codeoptions
optional An options object containing any custom settings that you want to apply to the generated QR code. The possible options are:qrSize
: Size of QR code. Default is 128className
: Class name of root SVG elementisShowLogo
: Show SPR logo in center of QR code Default is falseisShowBackground
: Show QR background. Default is falsebackgroundColor
: QR code background HEX color. Works ifisShowBackground
is enabled. Default is "#ffffff"foregroundColor
: QR code HEX colorlogoColor
: Color of logo. Default is "#6080ff"logoData
: Reference to logo as a reference IRIsuffix
: SVG elements id postfixecc
: ECC level in range [0-3] (0 - low, 3 - high)
Return value
A string with SVG code.
License
The code is available under the MIT license.