Socket
Socket
Sign inDemoInstall

@vkontakte/vk-qr

Package Overview
Dependencies
0
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vkontakte/vk-qr

QR Code generator


Version published
Weekly downloads
556
increased by58.86%
Maintainers
4
Install size
288 kB
Created
Weekly downloads
 

Readme

Source

npm NPM Build Status

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

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

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.

FAQs

Last updated on 15 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc