qrutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooLong = errors.New("text too long for a QR code")

Error for text that does not fit even the largest QR symbol at the chosen level

Functions

This section is empty.

Types

type Code

type Code struct {
	// contains filtered or unexported fields
}

QR symbol, a square of dark and light modules without the quiet zone around it

func Encode

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

Smallest QR symbol holding the bytes of text at the level, segmented into the modes that need the fewest bits and masked with the pattern that scores the lowest penalty

func (*Code) HalfBlocks

func (c *Code) HalfBlocks(border int, invert bool) string

Text of the symbol inside border light modules, two module rows per line of half block characters, every line ending in a newline and an odd last row leaving the lower half of its line unlit; invert draws the light modules as blocks for terminals with a dark background

func (*Code) Matrix

func (c *Code) Matrix(border int) [][]bool

Rows of the symbol inside border light modules on every side, true for a dark module

type Level

type Level int

How much of a QR symbol can be damaged and still read; higher levels hold less data

const (
	// About 7% of the symbol recoverable
	Low Level = iota
	// About 15% of the symbol recoverable
	Medium
	// About 25% of the symbol recoverable
	Quartile
	// About 30% of the symbol recoverable
	High
)

Jump to

Keyboard shortcuts

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