ansi

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 3 Imported by: 0

README

go-utils

GoDoc

A collection of GO libraries

Warning: unstable API, WIP

NOTICE: The rtag utility from this repo is relocated to http://github.com/adnsv/rtag

Libraries

library description
ansi utilities to support virtual terminal output
binpack binary resource packer
download download helpers
filesystem file system helpers
git git stats
gopackage a little helper to construct go build ... commands
markout a set of tiny pretty writers targeting markdown, html, and plain text output with the same API
osarch utilities to help with OS/ARCH pairs when building cross-platform targets
pack archiving
prompt utilities for building interactive cli applications
sourcecode tracking row:column locations within source code
unpack unarchiving
version version number utilities

Documentation

Automatically generated documentation for the included packages can be viewed online here: http://pkg.go.dev/github.com/adnsv/go-utils

Documentation

Index

Constants

View Source
const (
	Reset         = "\x1b[0m"
	Bold          = "\x1b[1m"
	Dim           = "\x1b[2m"
	Italic        = "\x1b[3m"
	Underline     = "\x1b[4m"
	Blinking      = "\x1b[5m"
	Inverse       = "\x1b[7m"
	Hidden        = "\x1b[8m"
	StrikeThrough = "\x1b[9m"
)
View Source
const Black = ColorIndex(0)
View Source
const White = ColorIndex(15)

Variables

This section is empty.

Functions

func Background added in v0.7.0

func Background(v ColorIndex) string

func BackgroundBlack added in v0.7.0

func BackgroundBlack() string

func BackgroundGray added in v0.7.0

func BackgroundGray(l byte) string

func BackgroundRGB added in v0.7.0

func BackgroundRGB(r, g, b byte) string

func BackgroundWhite added in v0.7.0

func BackgroundWhite() string

func Foreground added in v0.7.0

func Foreground(v ColorIndex) string

func ForegroundBlack added in v0.7.0

func ForegroundBlack() string

func ForegroundGray added in v0.7.0

func ForegroundGray(l byte) string

func ForegroundRGB added in v0.7.0

func ForegroundRGB(r, g, b byte) string

func ForegroundWhite added in v0.7.0

func ForegroundWhite() string

Types

type ColorIndex added in v0.7.0

type ColorIndex uint8

An index into a standard 256-color ANSI palette

func Gray added in v0.7.0

func Gray(l byte) ColorIndex

Gray maps luminance to an index in standard ANSI 256-color palette

input values [0..ff] are snapped to - 0x00 - 0x0A - 0x14 - 0x1E - 0x28 - 0x33 - 0x3D - 0x47 - 0x51 - 0x5B - 0x66 - 0x70 - 0x7A - 0x84 - 0x8E - 0x99 - 0xA3 - 0xAD - 0xB7 - 0xC1 - 0xCC - 0xD6 - 0xE0 - 0xEA - 0xF4 - 0xFF

func RGB added in v0.7.0

func RGB(r, g, b byte) ColorIndex

RGB maps rgb color to an index in standard ANSI 256-color palette

input color component values [0..ff] are snapped to - 0x00 - 0x33 - 0x66 - 0x99 - 0xcc - 0xff

type OutputState added in v0.7.0

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

OutputState allows restoring terminal to its original state

func SetupOutput added in v0.7.0

func SetupOutput(output *os.File) *OutputState

SetupOutput prepares/validates an output to support virtual terminal escape sequences

Windows hosts: - configures terminal for UTF-8 output (65001 codepage) - enables virtual terminal processing mode

Other hosts (linux, bsd): - checks for termios support

Returns: - ok: indicates if the output supports virtual terminal escape sequences (will fail for regular files) - cleanup: to be used for restoring the output to its original state

func SetupStdout added in v0.7.0

func SetupStdout() *OutputState

SetupStdout configures os.Stdout to support virtual terminal escape sequences

func (*OutputState) Restore added in v0.7.0

func (s *OutputState) Restore()

func (*OutputState) Supported added in v0.7.0

func (s *OutputState) Supported() bool

type Style added in v0.7.0

type Style int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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