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'
Full size ASCII block QR Code:
Smaller 'half blocks' in the terminal:
For command line usage see below, or grab the binary from the releases page
As a library in an application
go get github.com/mdp/qrterminal/v3
import (
"github.com/mdp/qrterminal/v3"
"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)
}
Large Inverted barcode with medium redundancy and a 1 pixel border
import (
"github.com/mdp/qrterminal/v3"
"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/v3"
"os"
)
func main() {
config := qrterminal.Config{
HalfBlocks: true,
Level: qrterminal.M,
Writer: os.Stdout,
}
qrterminal.GenerateWithConfig("https://github.com/mdp/qrterminal", config)
}
OSX: brew install mdp/tap/qrterminal
Others: Download from the releases page
Source: go install github.com/mdp/qrterminal/v3/cmd/qrterminal@latest
Docker: docker pull ghcr.io/mdp/qrterminal:latest
Print out a basic QR code in your terminal:
qrterminal https://github.com/mdp/qrterminal
Using 'medium' error correction:
qrterminal https://github.com/mdp/qrterminal -l M
Or just use Docker: docker run --rm ghcr.io/mdp/qrterminal:latest 'https://github.com/mdp/qrterminal'
You can also pipe text via stdin
cat wireguard_peer.conf | qrterminal
or
cat wireguard_peer.conf | docker run --rm -i ghcr.io/mdp/qrterminal:latest