colorable

package module
v0.0.0-...-4f56b49 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: MIT Imports: 5 Imported by: 3

README

go-colorable

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableColorsStdout

func EnableColorsStdout(enabled *bool) func()

EnableColorsStdout enable colors if possible.

func IsCygwinTerminal

func IsCygwinTerminal(fd uintptr) bool

func IsReaderTerminal

func IsReaderTerminal(file io.Reader) bool

func IsTerminal

func IsTerminal(fd uintptr) bool

func IsWriterTerminal

func IsWriterTerminal(file io.Writer) bool

func NewColorable

func NewColorable(file io.Writer) io.Writer

NewColorable returns new instance of Writer which handles escape sequence.

func NewColorableStderr

func NewColorableStderr() io.Writer

NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.

func NewColorableStdout

func NewColorableStdout() io.Writer

NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.

func NewNonColorableReader

func NewNonColorableReader(r io.Reader) io.Reader

func NewNonColorableWriter

func NewNonColorableWriter(w io.Writer) io.Writer

NewNonColorable returns new instance of Writer which removes escape sequence from Writer.

func NewNonConsoleSymbolWriter

func NewNonConsoleSymbolWriter(w io.Writer, conf NonConsoleSymbolConf) io.Writer

Types

type ConsoleSymbol

type ConsoleSymbol byte
const (
	T_A ConsoleSymbol = 'A' // 光标上移 \ cursor up
	T_B ConsoleSymbol = 'B' // 光标下移 \ cursor down
	T_C ConsoleSymbol = 'C' // 光标右移 \ cursor right
	T_D ConsoleSymbol = 'D' // 光标左移 \ cursor left
	T_E ConsoleSymbol = 'E' // 光标下移到下一行的开头 \ cursor down to the beginning of the next line
	T_F ConsoleSymbol = 'F' // 光标上移到上一行的开头 \ cursor up to the beginning of the previous line
	T_G ConsoleSymbol = 'G' // 光标移动到当前行的指定列 \ cursor moves to the specified column of the current line
	T_H ConsoleSymbol = 'H' // 光标移动到指定行和列 \ cursor moves to the specified row and column
	T_J ConsoleSymbol = 'J' // 清屏或清除从光标到屏幕的一部分 \ clear the screen or clear part of the screen from the cursor
	T_K ConsoleSymbol = 'K' // 清除从光标到行尾的一部分 \ clear part of the line from the cursor to the end of the line
	T_S ConsoleSymbol = 'S' // 向上滚动指定的行数 \ scroll up the specified number of lines
	T_T ConsoleSymbol = 'T' // 向下滚动指定的行数 \ scroll down the specified number of lines
	T_m ConsoleSymbol = 'm' // 设置颜色和格式 \ set color and format
	T_s ConsoleSymbol = 's' // 保存光标位置 \ save cursor position
	T_u ConsoleSymbol = 'u' // 恢复光标位置 \ restore cursor position
)

type NonConsoleSymbolConf

type NonConsoleSymbolConf struct {
	Ignore    []ConsoleSymbol
	IgnoreAll bool
}

type NonConsoleSymbolReader

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

func NewNonConsoleSymbolReader

func NewNonConsoleSymbolReader(r io.Reader, conf NonConsoleSymbolConf) *NonConsoleSymbolReader

func (*NonConsoleSymbolReader) Read

func (r *NonConsoleSymbolReader) Read(p []byte) (n int, err error)

type NonConsoleSymbolWriter

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

func (*NonConsoleSymbolWriter) Write

func (w *NonConsoleSymbolWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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