npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cxq--qrcode-with-logos

v1.0.2

Published

//11

Downloads

4

Readme

qrcode-with-logos

    //11

Introduction

QRcode-with-logos is a tool for creating a QRcode with a logo in your object.

It depend on qrcode dependence and be more powerful than qrcode.

It can create a canvas or a image for the QRcode and even you can use the method to download the file you want.

Usage

  • Install the module
npm install qrcode-with-logos --save

Options

content(required)

Type: String

QR Code content.

width

Type: Number

Default: 0

QR Code width.

canvas

Type: DomElement

Default: a new canvas tag

A canvas tag to show the QR code.

image

Type: DomElement

Default: a new img tag

A img tag to show the QR code.

download

Type: Boolean

Default: false

You can set the value to be true to download the file immediately, the premise is that you have use the toImage() methods.

Examplate

new QrCodeWithLogo({
  canvas: document.getElementById("canvas"),
  content: "https://github.com/zxpsuper",
  width: 380,
  download: true,
  image: document.getElementById("image"),
  logo: {
    src: "https://avatars1.githubusercontent.com/u/28730619?s=460&v=4"
  }
}).toImage();

downloadName

Type: String

Default: qr-code.png

Set the download file name, should be used with the download property.

nodeQrCodeOptions

Type: Object

nodeQrCodeOptions.margin:

Type Number -- qrcode margin

nodeQrCodeOptions.errorCorrectionLevel:

Type String-- qrcode errorCorrectionLevel, such as "M", "Q", "H"

nodeQrCodeOptions.scale:

Type Number-- qrcode scale

nodeQrCodeOptions.color:

Type Object-- qrcode color

nodeQrCodeOptions.color.dark:

Type String-- qrcode color value of dark

nodeQrCodeOptions.color.light:

Type String-- qrcode color value of light

logo

Type: Object

logo.src(required):

Type String-- logo url or logo module

logo.logoRadius:

Type Number -- Default: 0

logo.logoSize:

Type Number -- Default: 0.15, is the scale to qrcode

logo.borderRadius:

Type Number -- Default: 8

logo.borderColor:

Type String -- Default: "#ffffff"

logo.borderSize:

Type Number -- Default: 0.05 , is the scale to qrcode

logo.bgColor:

Type String -- Default: "#ffffff", the logo background color

logo.crossOrigin:

Type String -- Default: "Anonymous"

Methods

toCanvas() ———— Return Promise, show the qrcode by canvas tag

new QrCodeWithLogo({
  canvas: document.getElementById("canvas"),
  content: "https://github.com/zxpsuper",
  width: 380,
  //   download: true,
  image: document.getElementById("image"),
  logo: {
    src: "https://avatars1.githubusercontent.com/u/28730619?s=460&v=4"
  }
})
  .toCanvas()
  .then(() => {});

toImage() ———— Return Promise, show the qrcode by img tag

new QrCodeWithLogo({
  canvas: document.getElementById("canvas"),
  content: "https://github.com/zxpsuper",
  width: 380,
  //   download: true,
  image: document.getElementById("image"),
  logo: {
    src: "https://avatars1.githubusercontent.com/u/28730619?s=460&v=4"
  }
})
  .toImage()
  .then(() => {});

downloadImage(name: string) ———— Return Promise, set the filename and download the image, should be use after toImage() method.

let qrcode = new QrCodeWithLogo({
  canvas: document.getElementById("canvas"),
  content: "https://github.com/zxpsuper",
  width: 380,
  //   download: true,
  image: document.getElementById("image"),
  logo: {
    src: "https://avatars1.githubusercontent.com/u/28730619?s=460&v=4"
  }
});

qrcode.toImage().then(() => {
  setTimeout(() => {
    qrcode.downloadImage("hello world");
  }, 2000);
});

Example

<canvas id="canvas"></canvas> <img src="" alt="" id="image" />
<img id="image" alt="">
import QrCodeWithLogo from "qrcode-with-logos";
let qrcode = new QrCodeWithLogo({
  canvas: document.getElementById("canvas"),
  content: "https://github.com/zxpsuper",
  width: 380,
  //   download: true,
  image: document.getElementById("image"),
  logo: {
    src: "https://avatars1.githubusercontent.com/u/28730619?s=460&v=4"
  }
});

qrcode.toCanvas().then(() => {
  qrcode.toImage().then(() => {
    setTimeout(() => {
      qrcode.downloadImage("hello world");
    }, 2000);
  });
});

Ecosystem

| Project | Status | Description | | -------- | ---------------------------------- | ----------------------------- | | qrcode | qrcode-status | QR code/2d barcode generator. |

Questions or advise

If you have some question or advise, you can send me a E-mail([email protected]).