go.qrt: github.com/GeertJohan/go.qrt Index | Files | Directories

package qrt

import "github.com/GeertJohan/go.qrt"

Index

Package Files

qrt.go

Variables

var DefaultConfig = &Config{
    UseSGR: true,
    Level:  M,
}

DefaultConfig is used by the Generate function You can change it's values, or create a Config instance of your own.

func Generate Uses

func Generate(text string) (string, error)

Generate a text string to a QR code, which you can write to a terminal or file. Generate is a shorthand for DefaultConfig.Generate(text)

type Config Uses

type Config struct {
    // UseSGR, when true, Generate() uses Select Graphic Rendition (github.com/foize/go.sgr) to force correct colors in the terminal (black/white)
    // You should disable this when writing the result to a file
    UseSGR bool

    // Level indicates the required redudancy level for the generated QR's
    // You can keep the redundancy value low because screens are pretty bright and clean.... Or well, they should be.
    Level Level
}

Config hold all paramters that can be set with this library

func (*Config) Generate Uses

func (c *Config) Generate(text string) (string, error)

Generate a text string to a QR code, which you can write to a terminal or file.

type Level Uses

type Level int

A Level denotes a QR error correction level. From least to most tolerant of errors, they are L, M, Q, H.

const (
    L   Level = iota // 20% redundant
    M                // 38% redundant
    Q                // 55% redundant
    H                // 65% redundant
)

Directories

PathSynopsis
example

Package qrt imports 2 packages (graph) and is imported by 1 packages. Updated 2016-07-16. Refresh now. Tools for package owners.