Awesome
<img align="right" width="150px" src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/readme-logo.svg"/>
If you find my work useful you can buy me a coffee, I am very thankful for your support.
<a href="https://www.buymeacoffee.com/werthdavid" target="_blank"><img width="140" src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png" alt="Buy Me A Coffee"></a>
kjua-svg
Dynamically generated QR codes for modern browsers.
Uses kjua and
QR Code Generator (MIT).
If you are looking for a solutions to generate QR Codes with Angular, you can look into ngx-kjua.
Demo
<img src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/demo.png"/>Click here
Usage
const code = kjua(options);
document.getElementById("container").appendChild(code);
Options
Crisp
As you can set the size of the image, the amount of 'modules' (black/white boxes that make up the QR-code) is calculated based on the size and the amount of quiet
modules. The calculation can result in an odd number so that a module is e.g. 4.5 pixels big. The resulting image will be drawn fuzzy if crisp
is set to false. Setting it to true
will result in 'sharp' lines.
crisp false
<img src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/no-crisp.jpg"/>crisp true
<img src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/crisp.jpg"/>Label
Kjua lets you embed a text or image to the code. This can be set with the setting mode
.
This can reduce the readability of the code!
Image
<img src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/image.png"/>Image as Code
<img src="https://raw.githubusercontent.com/werthdavid/kjua/master/docs/image-as-code.png"/>Labelimage and Imagelabel
Use this, if you want a label AND an image. In these modes mSize
, mPosX
and mPosY
can be provided as an array.
In mode labelimage
, the first value (index 0) of the mSize
, mPosX
and mPosY
arrays is used for the label,
the second value (index 1) is used for image and vice versa. Also in labelimage
mode, the label is drawn before the
image is drawn and therefore kinda "in the background" if the two overlap.
All options
text
encoded content (defaults to ``)render
render-mode: 'image', 'canvas', 'svg' (defaults toimage
)crisp
render pixel-perfect lines (defaults totrue
)minVersion
minimum version: 1..40 (defaults to1
)ecLevel
error correction level: 'L', 'M', 'Q' or 'H' (defaults toL
)size
size in pixel (defaults to200
)fill
code color (defaults to#333
)back
background color (defaults to#fff
, for transparent use''
ornull
)rounded
roundend corners in pc: 0..100 (defaults to0
, not working ifrender
is set tosvg
)quiet
quiet zone in modules (defaults to0
)mode
modes: 'plain', 'label', 'image', 'imagelabel' or 'labelimage' (defaults toplain
, setlabel
orimage
property if you change this)mSize
label/image size in pc: 0..100 (defaults to30
) or a number-array ifmode
is 'imagelabel' or 'labelimage'mPosX
label/image pos x in pc: 0..100 (defaults to50
) or a number-array ifmode
is 'imagelabel' or 'labelimage'mPosY
label/image pos y in pc: 0..100 (defaults to50
) or a number-array ifmode
is 'imagelabel' or 'labelimage'label
additional label text (defaults to ``)fontname
font for additional label text (defaults tosans-serif
)fontcolor
font-color for additional label text (defaults to#333
)fontoutline
draw an outline on the label text in the color of theback
(defaults totrue
)image
additional image (defaults toundefined
, use an HTMLImageElement or base64-string)imageAsCode
draw the image as part of the code (defaults tofalse
)
More details can be found on larsjung.de/kjua
Differences to kjua
possibility to render QR-codes as SVG- image can be provided as base64-string
- draw the image as part of the code -->
imageAsCode
- new
modes
:labelimage
andimagelabel
- Typescript-types