gitee.com/quant1x/gox@v1.7.6/qrterminal/README.md (about) 1 # QRCode Terminal 2 3 [](https://travis-ci.org/mdp/qrterminal) 4 5 A golang library for generating QR codes in the terminal. 6 7 Originally this was a port of the [NodeJS version](https://github.com/gtanner/qrcode-terminal). Recently it's been 8 updated to allow for smaller code generation using ASCII 'half blocks' 9 10 ## Example 11 12 Full size ASCII block QR Code: 13 <img src="https://user-images.githubusercontent.com/2868/37992336-0ba06b56-31d1-11e8-9d32-5c6bb008dc74.png" alt="alt text" width="225" height="225"> 14 15 Smaller 'half blocks' in the terminal: 16 <img src="https://user-images.githubusercontent.com/2868/37992371-243d4238-31d1-11e8-92f8-e34a794b21af.png" alt="alt text" width="225" height="225"> 17 18 ## Install 19 20 `go get github.com/mdp/qrterminal` 21 22 ## Usage 23 24 ```go 25 import ( 26 "github.com/mdp/qrterminal" 27 "os" 28 ) 29 30 func main() { 31 // Generate a 'dense' qrcode with the 'Low' level error correction and write it to Stdout 32 qrterminal.Generate("https://github.com/mdp/qrterminal", qrterminal.L, os.Stdout) 33 } 34 ``` 35 36 ### More complicated 37 38 Large Inverted barcode with medium redundancy and a 1 pixel border 39 40 ```go 41 import ( 42 "github.com/mdp/qrterminal" 43 "os" 44 ) 45 46 func main() { 47 config := qrterminal.Config{ 48 Level: qrterminal.M, 49 Writer: os.Stdout, 50 BlackChar: qrterminal.WHITE, 51 WhiteChar: qrterminal.BLACK, 52 QuietZone: 1, 53 } 54 qrterminal.GenerateWithConfig("https://github.com/mdp/qrterminal", config) 55 } 56 ``` 57 58 HalfBlock barcode with medium redundancy 59 60 ```go 61 import ( 62 "github.com/mdp/qrterminal" 63 "os" 64 ) 65 66 func main() { 67 config := qrterminal.Config{ 68 HalfBlocks: true, 69 Level: qrterminal.M, 70 Writer: os.Stdout, 71 } 72 qrterminal.Generate("https://github.com/mdp/qrterminal", config) 73 } 74 ``` 75 76 Credits: 77 78 Mark Percival m@mdp.im 79 [Matthew Kennerly](https://github.com/mtkennerly) 80 [Viric](https://github.com/viric) 81 [WindomZ](https://github.com/WindomZ) 82 [mattn](https://github.com/mattn)