| 32 | } |
| 33 | |
| 34 | func TestExampleEncodeWithColourAndWithoutBorder(t *testing.T) { |
| 35 | q, err := New("https://example.org", Medium) |
| 36 | if err != nil { |
| 37 | t.Errorf("Error: %s", err) |
| 38 | return |
| 39 | } |
| 40 | |
| 41 | // Optionally, disable the QR Code border. |
| 42 | q.DisableBorder = true |
| 43 | |
| 44 | // Optionally, set the colours. |
| 45 | q.ForegroundColor = color.RGBA{R: 0x33, G: 0x33, B: 0x66, A: 0xff} |
| 46 | q.BackgroundColor = color.RGBA{R: 0xef, G: 0xef, B: 0xef, A: 0xff} |
| 47 | |
| 48 | err = q.WriteFile(256, "example2.png") |
| 49 | if err != nil { |
| 50 | t.Errorf("Error: %s", err) |
| 51 | return |
| 52 | } |
| 53 | } |