ansi

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 6 Imported by: 2

README

ansi

Basic set of ANSI escape sequences for writing minimal terminal applications.

Documentation

Index

Constants

View Source
const (
	ResetModes         = 0
	Bold               = 1
	Dim                = 2
	Italic             = 3
	Underline          = 4
	Blink              = 5
	Inverse            = 7
	Hidden             = 8
	StrikeThrough      = 9
	ResetBoldDim       = 22
	ResetItalic        = 23
	ResetUnderline     = 24
	ResetBlink         = 25
	ResetInverse       = 27
	ResetHidden        = 28
	ResetStrikethrough = 29
	FgBlack            = 30
	BgBlack            = 40
	FgRed              = 31
	BgRed              = 41
	FgGreen            = 32
	BgGreen            = 42
	FgYellow           = 33
	BgYellow           = 43
	FgBlue             = 34
	BgBlue             = 44
	FgMagenta          = 35
	BgMagenta          = 45
	FgCyan             = 36
	BgCyan             = 46
	FgWhite            = 37
	BgWhite            = 47
	FgDefault          = 39
	BgDefault          = 49
)

Variables

View Source
var (
	Stdout = Terminal{os.Stdout}
	Stderr = Terminal{os.Stderr}
)

Functions

func Esc

func Esc(modes ...int) string

Types

type SpinnerOptions

type SpinnerOptions struct {
	Chars           []string
	InitialText     string
	SpinnerInterval time.Duration
	ClearAfterStop  bool
	Buffered        bool
}

type Style

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

func MakeStyle

func MakeStyle(modes ...int) Style

func (Style) Fprint

func (style Style) Fprint(w io.Writer, args ...any)

func (Style) Fprintf

func (style Style) Fprintf(w io.Writer, format string, args ...any)

func (Style) Fprintln

func (style Style) Fprintln(w io.Writer, args ...any)

func (Style) Print

func (style Style) Print(args ...any)

func (Style) Printf

func (style Style) Printf(format string, args ...any)

func (Style) Println

func (style Style) Println(args ...any)

func (Style) Sprint

func (style Style) Sprint(args ...any) string

func (Style) Sprintf

func (style Style) Sprintf(format string, args ...any) string

func (Style) Sprintln

func (style Style) Sprintln(args ...any) string

type Terminal

type Terminal struct {
	io.Writer
}

func (Terminal) ClearAfterCursor

func (term Terminal) ClearAfterCursor()

func (Terminal) ClearBeforeCursor

func (term Terminal) ClearBeforeCursor()

func (Terminal) ClearLine

func (term Terminal) ClearLine()

func (Terminal) ClearLineAfterCursor

func (term Terminal) ClearLineAfterCursor()

func (Terminal) ClearLineBeforeCursor

func (term Terminal) ClearLineBeforeCursor()

func (Terminal) ClearScreen

func (term Terminal) ClearScreen()

func (Terminal) Print

func (term Terminal) Print(args ...any)

func (Terminal) Printf

func (term Terminal) Printf(format string, args ...any)

func (Terminal) Println

func (term Terminal) Println(args ...any)

func (Terminal) ResetCursor

func (term Terminal) ResetCursor()

func (Terminal) SavePosition

func (term Terminal) SavePosition()

func (Terminal) Set

func (term Terminal) Set(modes ...int)

func (Terminal) Spinner

func (term Terminal) Spinner(opts SpinnerOptions) (chan<- string, func())

Jump to

Keyboard shortcuts

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