Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vkcom/vk-qr
VK QR Code generator library
https://github.com/vkcom/vk-qr
qr qr-code qr-generator qrcode vk
Last synced: 1 day ago
JSON representation
VK QR Code generator library
- Host: GitHub
- URL: https://github.com/vkcom/vk-qr
- Owner: VKCOM
- License: mit
- Created: 2019-02-19T11:25:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-26T11:46:24.000Z (6 months ago)
- Last Synced: 2024-12-20T23:07:16.097Z (1 day ago)
- Topics: qr, qr-code, qr-generator, qrcode, vk
- Language: TypeScript
- Homepage:
- Size: 957 KB
- Stars: 61
- Watchers: 18
- Forks: 10
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/VKCOM/vk-qr)
[![npm][npm-shield]][npm-url] [![NPM][npm-downloads-shield]][npm-url] [![Build Status](https://travis-ci.org/VKCOM/vk-qr.svg?branch=master)](https://travis-ci.org/VKCOM/vk-qr)
# VK-QR
JavaScript library for generating SVG code of VK-style QR codes.
## Usage
Install via yarn
```
yarn add @vkontakte/vk-qr
```or npm
```
npm install @vkontakte/vk-qr
```And use in your code
```js
import vkQr from '@vkontakte/vk-qr';// Returns SVG code of generated 256x256 QR code with VK logo
const qrSvg = vkQr.createQR('Text to encode', {
qrSize: 256,
isShowLogo: true
});
```## API Reference
### Syntax
```js
generatedSvgCode = vkQr.createQR(text[, qrOptions]);
```### Parameters
- `text` _required_
String to generate a QR code- `options` _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 128- `className`: Class name of root SVG element
- `isShowLogo`: Show VK logo in center of QR code
Default is false- `isShowBackground`: Show QR background. Default is false
- `backgroundColor`: QR code background HEX color. Works if `isShowBackground` is enabled. Default is "#ffffff"
- `foregroundColor`: QR code HEX color
- `logoColor`: Color of logo. Default is "#4680c2"
- `logoData`: Reference to logo as a reference IRI
- `suffix`: SVG elements id postfix
- `ecc`: 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) license.
[npm-shield]: https://img.shields.io/npm/v/@vkontakte/vk-qr.svg
[npm-url]: https://npmjs.com/package/@vkontakte/vk-qr
[npm-downloads-shield]: https://img.shields.io/npm/dt/@vkontakte/vk-qr.svg