qr-code-styling
Advanced tools
Comparing version
{ | ||
"name": "qr-code-styling", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Add a style and an image to your QR code", | ||
@@ -5,0 +5,0 @@ "main": "lib/qr-code-styling.js", |
@@ -1,1 +0,71 @@ | ||
# qr-code-styling | ||
# QR Code Styling | ||
JavaScript library for generating QR codes with a logo and styling. | ||
### Examples | ||
<p float="left"> | ||
<img style="display:inline-block" src="https://github.com/kozakdenys/qr-code-styling/blob/master/app/assets/facebook_example.png" width="270" /> | ||
<img style="display:inline-block" src="https://github.com/kozakdenys/qr-code-styling/blob/master/app/assets/instagram_example.png" width="270" /> | ||
<img style="display:inline-block" src="https://github.com/kozakdenys/qr-code-styling/blob/master/app/assets/telegram_example.png" width="270" /> | ||
</p> | ||
### Installation | ||
``` | ||
npm install qr-code-styling | ||
``` | ||
### Ussage | ||
```HTML | ||
<!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 |
147427
1.98%72
7100%