mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-01 16:59:29 +01:00
2.0 KiB
2.0 KiB
QRCode Terminal
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:
Smaller ‘half blocks’ in the terminal:
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
.Generate("https://github.com/mdp/qrterminal", qrterminal.L, os.Stdout)
qrterminal}
More complicated
Large Inverted barcode with medium redundancy and a 1 pixel border
import (
"github.com/mdp/qrterminal"
"os"
)
func main() {
:= qrterminal.Config{
config : qrterminal.M,
Level: os.Stdout,
Writer: qrterminal.WHITE,
BlackChar: qrterminal.BLACK,
WhiteChar: 1,
QuietZone}
.GenerateWithConfig("https://github.com/mdp/qrterminal", config)
qrterminal}
HalfBlock barcode with medium redundancy
import (
"github.com/mdp/qrterminal"
"os"
)
func main() {
:= qrterminal.Config{
config : true,
HalfBlocks: qrterminal.M,
Level: os.Stdout,
Writer}
.Generate("https://github.com/mdp/qrterminal", config)
qrterminal}
Credits:
Mark Percival m@mdp.im
Matthew Kennerly
Viric
WindomZ
mattn