An open API service indexing awesome lists of open source software.

https://github.com/galihrivanto/fancy-qr

QR code with customizable styles
https://github.com/galihrivanto/fancy-qr

customizable-qr qr-code qr-code-component

Last synced: 5 months ago
JSON representation

QR code with customizable styles

Awesome Lists containing this project

README

          


Fancy QR

![NPM Version](https://img.shields.io/npm/v/%40galihrivanto%2Ffancy-qr)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/galihrivanto/fancy-qr/build-release.yaml)
![GitHub](https://img.shields.io/github/license/galihrivanto/fancy-qr)


A QR code generator with fancy styles options.

## Why?
I was involved in a project that create QR code editor with a lot of styles options and advanced features. This project is simplified version using basic canvas2d and svg. The abstraction is inspired (copied) from the project.

This project created to be used in [board2share project](https://github.com/galihrivanto/board2share), replacing plain 3rd party qr code generator.

## Installation

```bash
npm install @galihrivanto/fancy-qr
```

## Usage

```ts
import { QRCode } from '@galihrivanto/fancy-qr';

const qr = new QRCode(640);
qr.attachTo(document.getElementById('app') as HTMLElement);
qr.setText('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.');
qr.setOuterFinder({
shape: 'OuterFinder.Drop',
fill: {
type: GradientType.Radial,
from: 'red',
to: 'blue'
}
});
qr.setData({
shape: 'Data.Circle',
fill: {
type: GradientType.Radial,
from: 'red',
to: 'blue'
}
});
```