.d88888b. 8888888b. d8b d88P" "Y88b 888 Y88b Y8P 888 888 888 888 888 888 888 d88P 888 .d88b. 888 888 .d8888b 888 888 8888888P" 888 d88""88b 888 888 88K 888 Y8b 888 888 T88b 888 888 888 888 888 "Y8888b. Y88b.Y8b88P 888 T88b 888 Y88..88P Y88b 888 X88 "Y888888" 888 T88b 888 "Y88P" "Y88888 88888P' Y8b
Install using the package manager for your desired environment(s):
$ npm install --save qrious# OR:$ bower install --save qrious
If you want to simply download the file to be used in the browser you can find them below:
demo.html in your browser to play around a bit.
Simply create an instance of
QRious and you've done most of the work. You can control many aspects of the QR code
using the following fields on your instance:
|background||String||Background color of the QR code||
|backgroundAlpha||Number||Background alpha of the QR code||
|element||Element||Element to render the QR code||
|foreground||String||Foreground color of the QR code||
|foregroundAlpha||Number||Foreground alpha of the QR code||
|level||String||Error correction level of the QR code (L, M, Q, H)||
|mime||String||MIME type used to render the image for the QR code||
|padding||Number||Padding for the QR code (pixels)||
|size||Number||Size of the QR code (pixels)||
|value||String||Value encoded within the QR code||
var qr = ;qrbackground = 'green';qrbackgroundAlpha = 08;qrforeground = 'blue';qrforegroundAlpha = 08;qrlevel = 'H';qrpadding = 25;qrsize = 500;qrvalue = '';
The QR code will automatically update when you change one of these fields, so be wary when you plan on changing lots of
fields at the same time. You probably want to make a single call to
set(options) instead as it will only update the QR
var qr = ;qr;
These can also be passed as options to the constructor itself:
var qr =background: 'green'backgroundAlpha: 08foreground: 'blue'foregroundAlpha: 08level: 'H'padding: 25size: 500value: '';
You can also pass in an
element option to the constructor which can be used to generate the QR code using an existing
DOM element, which is the only time that you can specify read only options.
element must either be a
element or an
<img> element which can then be accessed via the
image fields on the instance
respectively. An element will be created for whichever one isn't provided or for both if no
element is specified,
which means that they can be appended to the document at a later time.
var qr =element: documentvalue: '';qrcanvasparentNode;
A reference to the
QRious instance is also stored on both of the elements for convenience.
var canvas = document;var qr =element: canvasvalue: '';qr === canvasqrious;//=> true
Generates a base64 encoded data URI for the QR code. If you don't specify a MIME type, it will default to the one
passed to the constructor as an option or the default value for the
var qr =value: '';qr;//=> "data:image/png;base64,iVBOR...AIpqDnseH86KAAAAAElFTkSuQmCC"qr;//=> "data:image/jpeg;base64,/9j/...xqAqIqgKFAAAAAq3RRQAUUUUAf/Z"
Migrating from older versions
If you've been using an older major version and would like details on what's changed and information on how to migrate to the latest major release below:
If you want to contribute, you're a legend! Information on how you can do so can be found in CONTRIBUTING.md. We want your suggestions and pull requests!
A list of QRious contributors can be found in AUTHORS.md.
Copyright © 2017 Alasdair Mercer
Copyright © 2010 Tom Zerucha
See LICENSE.md for more information on our GPLv3 license.