ansi

package
v1.0.0-...-e3b73d2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 0 Imported by: 16

Documentation

Overview

Package ansi defines constants of ANSI graphic mode codes and sequences.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDict = map[string]Attribute{
	"-":          Reset,
	"reset":      Reset,
	"b":          Bold,
	"bold":       Bold,
	"u":          Underscore,
	"underscore": Underscore,
	"underline":  Underscore,
	"blink":      Blink,
	"reverse":    Reverse,
	"conceal":    Concealed,
	"black":      Black,
	"red":        Red,
	"green":      Green,
	"yellow":     Yellow,
	"blue":       Blue,
	"magenta":    Magenta,
	"cyan":       Cyan,
	"white":      White,
	"default":    Default,
	"bg":         Background,
	"background": Background,
	"intensive":  Intensive,
	"light":      Light,
}

DefaultDict is the default dictionary on ANSI attributes used in styles defined in the package.

Functions

This section is empty.

Types

type Attribute

type Attribute int

Attribute is the numerc code used in ANSI sequence.

const (
	// SequenceStart is ANSI graphic mode sequence start
	SequenceStart = "\033["
	// SequenceEnd is ANSI graphic mode sequence end
	SequenceEnd = "m"
	// SequenceDelimiter is the delimiter of ANSI graphic modes
	SequenceDelimiter = ";"

	// Reset makes all attributes off
	Reset Attribute = 0

	// Bold makes font bold (or brighter)
	Bold Attribute = 1
	// Underscore (or underline) makes font underline.
	Underscore Attribute = 4
	// Blink makes font blink
	Blink Attribute = 5
	// Reverse reverses tex and background colors
	Reverse Attribute = 7
	// Concealed makes text comcealed
	Concealed Attribute = 8

	// Black makes text color black
	Black Attribute = 30
	// Red makes text color red
	Red Attribute = 31
	// Green makes text color green
	Green Attribute = 32
	// Yellow makes text color yellow
	Yellow Attribute = 33
	// Blue makes text color blue
	Blue Attribute = 34
	// Magenta makes text color magenta
	Magenta Attribute = 35
	// Cyan makes text color cyan
	Cyan Attribute = 36
	// White makes text color white
	White Attribute = 37
	// Default resets text color to the default color
	Default Attribute = 39

	// Background when added to text color makes the result mode which has effect
	// on the background, e.g. `Red + Background` makes red background ANSI mode.
	Background Attribute = 10

	// Intensive when added to text color makes the result mode to have high
	// intensive color, e.g. `Blue + Intensive` makes high intensive blue text
	// color. Can be used with Background like `Cyan + Background + Intensive`.
	Intensive Attribute = 60

	// Light is the synonym to Intensive
	Light Attribute = 60
)
const InvalidAttribute Attribute = -1

InvalidAttribute identifies improperly defined ANSI codes.

func (Attribute) IsValid

func (attr Attribute) IsValid() bool

IsValid tests if the attribute is valid ANSI code.

Jump to

Keyboard shortcuts

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