code

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package qr provides functionality for encoding QR codes. Support for output to terminal as well as PNG support.

Example
qr, _ := New("go", Low)
qr.Print()
Output:

█▀▀▀▀▀▀▀███▀█▀█▀▀▀▀▀▀▀█
█ █▀▀▀█ █▀█▀█▄█ █▀▀▀█ █
█ █   █ ██▀█▀ █ █   █ █
█ ▀▀▀▀▀ █▀▄ ▄▀█ ▀▀▀▀▀ █
█▀▀▀█▀▀▀▀ █ █▀▀▀███▀███
█  ▀▄█▄▀▀███ █ ▀ █▀▄  █
█▀ █▀ ▄▀▄█ █ ▄ ▀ ▄▄▀▀ █
█▀▀▀▀▀▀▀█   █▀█▄█▀█▄  █
█ █▀▀▀█ █ ▀▄█▀█ █▀█ ▄ █
█ █   █ █▀ ▀ █ ▀ █ ▀▄▀█
█ ▀▀▀▀▀ █ ██ ▄ ▀ ▄ ▀ ▀█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

Index

Examples

Constants

View Source
const (
	Low     = qr.L
	Medium  = qr.M
	High    = qr.Q
	Highest = qr.H
)

Variables

This section is empty.

Functions

func Version

func Version() string

Version returns version

Types

type Code

type Code struct {
	*qr.Code
}

Code wraps module import

func New

func New(text string, level Level) (*Code, error)

New creates a new QR Code. Error correction levels are 0, 1, 2, 3. 3 being the highest level of correction.

func (*Code) Big

func (c *Code) Big(w io.Writer)

Big writes a larger Code to io.Writer w. Great for terminal.

func (*Code) Image

func (c *Code) Image() image.Image

Image returns an image.Image

func (*Code) PNG

func (c *Code) PNG(w io.Writer) error

PNG writes a PNG image to io.Writer w

func (*Code) Print

func (c *Code) Print()

Print writes Code to os.Stdout

func (*Code) Small

func (c *Code) Small(w io.Writer)

Small writes Code to io.Writer w. Perfect for terminal.

type Level

type Level = qr.Level

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL