5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-28 18:21:35 +00:00
matterbridge/vendor/github.com/mdp/qrterminal
2022-03-20 14:57:48 +01:00
..
.travis.yml Add dependencies/vendor (whatsapp) 2022-03-20 14:57:48 +01:00
CHANGELOG.md Add dependencies/vendor (whatsapp) 2022-03-20 14:57:48 +01:00
qrterminal.go Add dependencies/vendor (whatsapp) 2022-03-20 14:57:48 +01:00
README.md Add dependencies/vendor (whatsapp) 2022-03-20 14:57:48 +01:00

QRCode Terminal

Build Status

A golang library for generating QR codes in the terminal.

Originally this was a port of the NodeJS version. Recently it's been updated to allow for smaller code generation using ASCII 'half blocks'

Example

Full size ASCII block QR Code:
alt text

Smaller 'half blocks' in the terminal:
alt text

Install

go get github.com/mdp/qrterminal

Usage

import (
    "github.com/mdp/qrterminal"
    "os"
    )

func main() {
  // Generate a 'dense' qrcode with the 'Low' level error correction and write it to Stdout
  qrterminal.Generate("https://github.com/mdp/qrterminal", qrterminal.L, os.Stdout)
}

More complicated

Large Inverted barcode with medium redundancy and a 1 pixel border

import (
    "github.com/mdp/qrterminal"
    "os"
    )

func main() {
  config := qrterminal.Config{
      Level: qrterminal.M,
      Writer: os.Stdout,
      BlackChar: qrterminal.WHITE,
      WhiteChar: qrterminal.BLACK,
      QuietZone: 1,
  }
  qrterminal.GenerateWithConfig("https://github.com/mdp/qrterminal", config)
}

HalfBlock barcode with medium redundancy

import (
    "github.com/mdp/qrterminal"
    "os"
    )

func main() {
  config := qrterminal.Config{
      HalfBlocks: true,
      Level: qrterminal.M,
      Writer: os.Stdout,
  }
  qrterminal.Generate("https://github.com/mdp/qrterminal", config)
}

Credits:

Mark Percival m@mdp.im
Matthew Kennerly
Viric
WindomZ
mattn