ansi

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bgblack = MakeCode([]int{40}, []int{49})
View Source
var Bgblue = MakeCode([]int{44}, []int{49})
View Source
var BgbrightBlack = MakeCode([]int{100}, []int{49})
View Source
var BgbrightBlue = MakeCode([]int{104}, []int{49})
View Source
var BgbrightCyan = MakeCode([]int{106}, []int{49})
View Source
var BgbrightGreen = MakeCode([]int{102}, []int{49})
View Source
var BgbrightMagenta = MakeCode([]int{105}, []int{49})
View Source
var BgbrightRed = MakeCode([]int{101}, []int{49})
View Source
var BgbrightWhite = MakeCode([]int{107}, []int{49})
View Source
var BgbrightYellow = MakeCode([]int{103}, []int{49})
View Source
var Bgcyan = MakeCode([]int{46}, []int{49})
View Source
var Bggreen = MakeCode([]int{42}, []int{49})
View Source
var Bgmagenta = MakeCode([]int{45}, []int{49})
View Source
var Bgred = MakeCode([]int{41}, []int{49})
View Source
var Bgwhite = MakeCode([]int{47}, []int{49})
View Source
var Bgyellow = MakeCode([]int{43}, []int{49})
View Source
var Black = MakeCode([]int{30}, []int{39})
View Source
var Blue = MakeCode([]int{34}, []int{39})
View Source
var Bold = MakeCode([]int{1}, []int{22})
View Source
var BrightBlack = MakeCode([]int{90}, []int{39})
View Source
var BrightBlue = MakeCode([]int{94}, []int{39})
View Source
var BrightCyan = MakeCode([]int{96}, []int{39})
View Source
var BrightGreen = MakeCode([]int{92}, []int{39})
View Source
var BrightMagenta = MakeCode([]int{95}, []int{39})
View Source
var BrightRed = MakeCode([]int{91}, []int{39})
View Source
var BrightWhite = MakeCode([]int{97}, []int{39})
View Source
var BrightYellow = MakeCode([]int{93}, []int{39})
View Source
var Cyan = MakeCode([]int{36}, []int{39})
View Source
var Green = MakeCode([]int{32}, []int{39})
View Source
var Inverse = MakeCode([]int{7}, []int{27})
View Source
var Italic = MakeCode([]int{3}, []int{23})
View Source
var Magenta = MakeCode([]int{35}, []int{39})
View Source
var Red = MakeCode([]int{31}, []int{39})
View Source
var Reset = MakeCode([]int{}, []int{})
View Source
var StringToCode = map[string]Code{
	"black":           Black,
	"red":             Red,
	"green":           Green,
	"yellow":          Yellow,
	"blue":            Blue,
	"magenta":         Magenta,
	"cyan":            Cyan,
	"white":           White,
	"brightblack":     BrightBlack,
	"brightred":       BrightRed,
	"brightgreen":     BrightGreen,
	"brightyellow":    BrightYellow,
	"brightblue":      BrightBlue,
	"brightmagenta":   BrightMagenta,
	"brightcyan":      BrightCyan,
	"brightwhite":     BrightWhite,
	"bgblack":         Bgblack,
	"bgred":           Bgred,
	"bggreen":         Bggreen,
	"bgyellow":        Bgyellow,
	"bgblue":          Bgblue,
	"bgmagenta":       Bgmagenta,
	"bgcyan":          Bgcyan,
	"bgwhite":         Bgwhite,
	"bgbrightblack":   BgbrightBlack,
	"bgbrightred":     BgbrightRed,
	"bgbrightgreen":   BgbrightGreen,
	"bgbrightyellow":  BgbrightYellow,
	"bgbrightblue":    BgbrightBlue,
	"bgbrightmagenta": BgbrightMagenta,
	"bgbrightcyan":    BgbrightCyan,
	"bgbrightwhite":   BgbrightWhite,
	"bold":            Bold,
	"italic":          Italic,
	"underline":       Underline,
	"inverse":         Inverse,
}
View Source
var Underline = MakeCode([]int{4}, []int{24})
View Source
var White = MakeCode([]int{37}, []int{39})
View Source
var Yellow = MakeCode([]int{33}, []int{39})

Functions

func Len

func Len(s string) int

Len of string excluding ANSI escape sequences

func Truncate added in v0.0.7

func Truncate(s string, n int) string

Truncate string to n visible characters. An ANSI reset is added to the end of the string.

Types

type Code

type Code struct {
	Set         []int
	Reset       []int
	SetString   string
	ResetString string
}
var None Code

func FromString

func FromString(s string) Code

func MakeCode

func MakeCode(set []int, reset []int) Code

func (Code) Add

func (c Code) Add(a Code) Code

func (Code) F

func (c Code) F(s interface{}) fmt.Formatter

func (Code) W

func (c Code) W(w io.Writer) io.Writer

func (Code) Wrap

func (c Code) Wrap(s string) string

func (Code) Write

func (c Code) Write(w io.Writer, p []byte) (int, error)

Jump to

Keyboard shortcuts

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