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 🙏

© 2026 – Pkg Stats / Ryan Hefner

hexo-helper-qrcode-adv

v1.0.2

Published

Advanced QR code helper for Hexo that generates QR codes for page sharing with extensive styling options

Readme

hexo-helper-qrcode-adv

Advanced QR code helper for Hexo that generates QR codes for page sharing with extensive styling options using qr-code-styling

Installation

npm install hexo-helper-qrcode-adv

Canvas Support (Optional)

For canvas/PNG output support, install the canvas dependency:

npm install canvas

Note: Canvas installation requires native dependencies. On Windows, you may need Visual Studio Build Tools. If canvas installation fails, the plugin will automatically fall back to SVG output.

Image Support

Center images are not supported in this plugin. Image support was removed due to image handling in qr-code-styling caused hanging and timeouts in Node.js environments. For QR codes with logos, consider using client-side QR generation libraries or external QR code services.

Usage

Use the renderQRCode() helper in your EJS templates. The helper supports three output modes:

  • Inline SVG (default): Returns SVG markup directly
  • Canvas: Returns base64 PNG as img tag (requires canvas dependency)
  • File: Saves to public/qr/ directory and returns img tag

Basic Usage

<%- renderQRCode() %>

With Options

<%- renderQRCode({
  data: 'https://example.com',
  size: 300,
  margin: 2,
  color: {
    dark: '#000000',
    light: '#FFFFFF'
  }
}) %>

Configuration

Add QR code styling options to your _config.yml:

qrcode:
  enable: true  # Enable/disable QR code generation (default: true)
  width: 300
  height: 300
  output: inline  # 'inline', 'canvas', or 'file'
  shape: square  # 'square' or 'circle'
  margin: 4
  qrOptions:
    typeNumber: 0  # 0-40
    mode: Byte  # 'Numeric', 'Alphanumeric', 'Byte', 'Kanji'
    errorCorrectionLevel: M  # 'L', 'M', 'Q', 'H'
  dotsOptions:
    color: '#000000'
    type: square  # 'rounded', 'dots', 'classy', 'classy-rounded', 'square', 'extra-rounded'
    roundSize: true
    gradient:
      type: linear  # 'linear' or 'radial'
      rotation: 0
      colorStops:
        - offset: 0
          color: '#000000'
        - offset: 1
          color: '#333333'
  backgroundOptions:
    color: '#FFFFFF'
    gradient:
      type: radial
      colorStops:
        - offset: 0
          color: '#FFFFFF'
        - offset: 1
          color: '#F0F0F0'
  cornersSquareOptions:
    color: '#000000'
    type: square  # 'dot', 'square', 'extra-rounded', 'rounded', 'dots', 'classy', 'classy-rounded'
    gradient:
      type: linear
      rotation: 0
      colorStops:
        - offset: 0
          color: '#000000'
        - offset: 1
          color: '#333333'
  cornersDotOptions:
    color: '#000000'
    type: square  # 'dot', 'square', 'rounded', 'dots', 'classy', 'classy-rounded', 'extra-rounded'

Helper Options

The helper accepts these options (override config defaults):

  • data (string): Data to encode in QR code. Defaults to current page URL
  • url (string): Alias for data (for backward compatibility)
  • size (number): Sets both width and height. Overrides config width/height
  • margin (number): Margin around QR code
  • output (string): Output mode - 'inline' (SVG), 'canvas' (PNG), or 'file' (saved image)
  • color (object): Quick color setup
    • dark (string): Foreground color (overrides dotsOptions.color)
    • light (string): Background color (overrides backgroundOptions.color)

Examples

Basic with custom colors

<%- renderQRCode({
  color: { dark: '#4267b2', light: '#e9ebee' }
}) %>

Styled QR code

<%- renderQRCode({
  data: 'https://example.com',
  size: 250,
  margin: 10
}) %>

Output modes

<!-- Inline SVG (default) -->
<%- renderQRCode({ output: 'inline' }) %>

<!-- Canvas PNG -->
<%- renderQRCode({ output: 'canvas' }) %>

<!-- Saved file -->
<%- renderQRCode({ output: 'file' }) %>

Configuration Options Reference

Basic Options

  • enable (boolean): Enable/disable QR code generation (default: true)
  • width/height (number): Canvas size in pixels
  • output (string): Output mode - 'inline' (SVG), 'canvas' (PNG), or 'file' (saved image)
  • shape (string): 'square' or 'circle'
  • margin (number): Margin around canvas

QR Options

  • qrOptions.typeNumber (0-40): QR code version
  • qrOptions.mode (string): Data encoding mode
  • qrOptions.errorCorrectionLevel (string): Error correction level

Styling Options

  • dotsOptions: QR dot styling (color, type, gradient)
  • backgroundOptions: Background styling (color, gradient)
  • cornersSquareOptions: Corner square styling
  • cornersDotOptions: Corner dot styling

Gradient Structure

gradient:
  type: linear  # 'linear' or 'radial'
  rotation: 0   # Rotation in radians
  colorStops:
    - offset: 0    # 0-1 position
      color: '#000'
    - offset: 1
      color: '#333'

License

MIT