diff --git a/qrcode/main.go b/qrcode/main.go index e91ef73..bddfb09 100644 --- a/qrcode/main.go +++ b/qrcode/main.go @@ -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 @@ -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)