Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion qrcode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func main() {
outFile := flag.String("o", "", "out PNG file prefix, empty for stdout")
size := flag.Int("s", 256, "image size (pixel)")
textArt := flag.Bool("t", false, "print as text-art on stdout")
negative := flag.Bool("i", false, "invert black and white")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, `qrcode -- QR Code encoder in Go
https://github.com/skip2/go-qrcode
Expand Down Expand Up @@ -56,11 +57,15 @@ Usage:
checkError(err)

if *textArt {
art := qr2String(q, false)
art := qr2String(q, *negative)
fmt.Println(art)
return
}

if *negative {
q.ForegroundColor, q.BackgroundColor = q.BackgroundColor, q.ForegroundColor
}

var png []byte
png, err = q.PNG(*size)
checkError(err)
Expand Down