pp

package
v0.4.43 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RED    = getColorCached(FgRed)
	GREEN  = getColorCached(FgGreen)
	BLUE   = getColorCached(FgBlue)
	CYAN   = getColorCached(FgCyan)
	YELLOW = getColorCached(FgYellow)

	BOLD      = getColorCached(Bold)
	UNDERLINE = getColorCached(Underline)
	ITALIC    = getColorCached(Italic)

	BOLDUNDERLINE   = GetColor(Bold, Underline)
	REDUNDERLINE    = GetColor(FgRed, Underline)
	GREENUNDERLINE  = GetColor(FgGreen, Underline)
	BLUEUNDERLINE   = GetColor(FgBlue, Underline)
	CYANUNDERLINE   = GetColor(FgCyan, Underline)
	YELLOWUNDERLINE = GetColor(FgYellow, Underline)
)

Functions

func BluePrint

func BluePrint(a ...interface{})

func BluePrintf

func BluePrintf(format string, a ...interface{})

func BluePrintln

func BluePrintln(a ...interface{})

func BlueUnderlinePrint

func BlueUnderlinePrint(a ...interface{})

func BlueUnderlinePrintf

func BlueUnderlinePrintf(format string, a ...interface{})

func BlueUnderlinePrintln

func BlueUnderlinePrintln(a ...interface{})

func BoldPrint

func BoldPrint(a ...interface{})

func BoldPrintf

func BoldPrintf(format string, a ...interface{})

func BoldPrintln

func BoldPrintln(a ...interface{})

func BoldUnderlinePrint

func BoldUnderlinePrint(a ...interface{})

func BoldUnderlinePrintf

func BoldUnderlinePrintf(format string, a ...interface{})

func BoldUnderlinePrintln

func BoldUnderlinePrintln(a ...interface{})

func CyanPrint

func CyanPrint(a ...interface{})

func CyanPrintf

func CyanPrintf(format string, a ...interface{})

func CyanPrintln

func CyanPrintln(a ...interface{})

func CyanUnderlinePrint

func CyanUnderlinePrint(a ...interface{})

func CyanUnderlinePrintf

func CyanUnderlinePrintf(format string, a ...interface{})

func CyanUnderlinePrintln

func CyanUnderlinePrintln(a ...interface{})

func EBluePrint

func EBluePrint(a ...interface{})

func EBluePrintf

func EBluePrintf(format string, a ...interface{})

func EBluePrintln

func EBluePrintln(a ...interface{})

func EBlueUnderlinePrint

func EBlueUnderlinePrint(a ...interface{})

func EBlueUnderlinePrintf

func EBlueUnderlinePrintf(format string, a ...interface{})

func EBlueUnderlinePrintln

func EBlueUnderlinePrintln(a ...interface{})

func EBoldPrint

func EBoldPrint(a ...interface{})

func EBoldPrintf

func EBoldPrintf(format string, a ...interface{})

func EBoldPrintln

func EBoldPrintln(a ...interface{})

func EBoldUnderlinePrint

func EBoldUnderlinePrint(a ...interface{})

func EBoldUnderlinePrintf

func EBoldUnderlinePrintf(format string, a ...interface{})

func EBoldUnderlinePrintln

func EBoldUnderlinePrintln(a ...interface{})

func ECyanPrint

func ECyanPrint(a ...interface{})

func ECyanPrintf

func ECyanPrintf(format string, a ...interface{})

func ECyanPrintln

func ECyanPrintln(a ...interface{})

func ECyanUnderlinePrint

func ECyanUnderlinePrint(a ...interface{})

func ECyanUnderlinePrintf

func ECyanUnderlinePrintf(format string, a ...interface{})

func ECyanUnderlinePrintln

func ECyanUnderlinePrintln(a ...interface{})

func EGreenPrint

func EGreenPrint(a ...interface{})

func EGreenPrintf

func EGreenPrintf(format string, a ...interface{})

func EGreenPrintln

func EGreenPrintln(a ...interface{})

func EGreenUnderlinePrint

func EGreenUnderlinePrint(a ...interface{})

func EGreenUnderlinePrintf

func EGreenUnderlinePrintf(format string, a ...interface{})

func EGreenUnderlinePrintln

func EGreenUnderlinePrintln(a ...interface{})

func EItalicPrint

func EItalicPrint(a ...interface{})

func EItalicPrintf

func EItalicPrintf(format string, a ...interface{})

func EItalicPrintln

func EItalicPrintln(a ...interface{})

func EPrint

func EPrint(a ...interface{})

func EPrintf

func EPrintf(format string, a ...interface{})

func EPrintln

func EPrintln(a ...interface{})

func ERedPrint

func ERedPrint(a ...interface{})

func ERedPrintf

func ERedPrintf(format string, a ...interface{})

func ERedPrintln

func ERedPrintln(a ...interface{})

func ERedUnderlinePrint

func ERedUnderlinePrint(a ...interface{})

func ERedUnderlinePrintf

func ERedUnderlinePrintf(format string, a ...interface{})

func ERedUnderlinePrintln

func ERedUnderlinePrintln(a ...interface{})

func EUnderlinePrint

func EUnderlinePrint(a ...interface{})

func EUnderlinePrintf

func EUnderlinePrintf(format string, a ...interface{})

func EUnderlinePrintln

func EUnderlinePrintln(a ...interface{})

func EYellowPrint

func EYellowPrint(a ...interface{})

func EYellowPrintf

func EYellowPrintf(format string, a ...interface{})

func EYellowPrintln

func EYellowPrintln(a ...interface{})

func EYellowUnderlinePrint

func EYellowUnderlinePrint(a ...interface{})

func EYellowUnderlinePrintf

func EYellowUnderlinePrintf(format string, a ...interface{})

func EYellowUnderlinePrintln

func EYellowUnderlinePrintln(a ...interface{})

func GreenPrint

func GreenPrint(a ...interface{})

func GreenPrintf

func GreenPrintf(format string, a ...interface{})

func GreenPrintln

func GreenPrintln(a ...interface{})

func GreenUnderlinePrint

func GreenUnderlinePrint(a ...interface{})

func GreenUnderlinePrintf

func GreenUnderlinePrintf(format string, a ...interface{})

func GreenUnderlinePrintln

func GreenUnderlinePrintln(a ...interface{})

func ItalicPrint

func ItalicPrint(a ...interface{})

func ItalicPrintf

func ItalicPrintf(format string, a ...interface{})

func ItalicPrintln

func ItalicPrintln(a ...interface{})

func Print

func Print(a ...interface{})

func PrintLine

func PrintLine(s string)

func PrintLineIfNotEmpty

func PrintLineIfNotEmpty(s string)

func Printf

func Printf(format string, a ...interface{})

func Println

func Println(a ...interface{})

func RedPrint

func RedPrint(a ...interface{})

func RedPrintf

func RedPrintf(format string, a ...interface{})

func RedPrintln

func RedPrintln(a ...interface{})

func RedUnderlinePrint

func RedUnderlinePrint(a ...interface{})

func RedUnderlinePrintf

func RedUnderlinePrintf(format string, a ...interface{})

func RedUnderlinePrintln

func RedUnderlinePrintln(a ...interface{})

func UnderlinePrint

func UnderlinePrint(a ...interface{})

func UnderlinePrintf

func UnderlinePrintf(format string, a ...interface{})

func UnderlinePrintln

func UnderlinePrintln(a ...interface{})

func YellowPrint

func YellowPrint(a ...interface{})

func YellowPrintf

func YellowPrintf(format string, a ...interface{})

func YellowPrintln

func YellowPrintln(a ...interface{})

func YellowUnderlinePrint

func YellowUnderlinePrint(a ...interface{})

func YellowUnderlinePrintf

func YellowUnderlinePrintf(format string, a ...interface{})

func YellowUnderlinePrintln

func YellowUnderlinePrintln(a ...interface{})

Types

type Attribute

type Attribute int

Attribute defines a single SGR Code

const (
	Reset Attribute = iota
	Bold
	Faint
	Italic
	Underline
	BlinkSlow
	BlinkRapid
	ReverseVideo
	Concealed
	CrossedOut
)

Base attributes

const (
	FgBlack Attribute = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground text colors

const (
	FgHiBlack Attribute = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity text colors

const (
	BgBlack Attribute = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background text colors

const (
	BgHiBlack Attribute = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity text colors

type Color

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

Color defines a custom color object which is defined by SGR parameters.

func GetColor

func GetColor(attributes ...Attribute) *Color

GetColor 利用 attribute 获取 Color

func (*Color) Equals

func (c *Color) Equals(c2 *Color) bool

Equals returns a boolean value indicating whether two colors are equal.

func (*Color) Sprint

func (c *Color) Sprint(noColor bool, a ...interface{}) string

Sprint is just like Print, but returns a string instead of printing it.

func (*Color) Sprintf

func (c *Color) Sprintf(noColor bool, format string, a ...interface{}) string

Sprintf is just like Printf, but returns a string instead of printing it.

func (*Color) Sprintln

func (c *Color) Sprintln(noColor bool, a ...interface{}) string

Sprintln is just like Println, but returns a string instead of printing it.

type Printer

type Printer struct {
	NoColor bool
	// contains filtered or unexported fields
}

func NewPrinter

func NewPrinter(w io.Writer, noColor bool) *Printer

func (*Printer) ChangeWriter

func (p *Printer) ChangeWriter(newWriter io.Writer)

func (*Printer) CurrentWriter

func (p *Printer) CurrentWriter() io.Writer

func (*Printer) Print

func (p *Printer) Print(color *Color, a ...interface{}) error

func (*Printer) Printf

func (p *Printer) Printf(color *Color, format string, a ...interface{}) error

func (*Printer) Println

func (p *Printer) Println(color *Color, a ...interface{}) error

func (*Printer) Write

func (p *Printer) Write(b []byte) (n int, err error)

type String

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

func BlueString

func BlueString(format string, a ...interface{}) String

func BlueUnderlineString

func BlueUnderlineString(format string, a ...interface{}) String

func BoldString

func BoldString(format string, a ...interface{}) String

func BoldUnderlineString

func BoldUnderlineString(format string, a ...interface{}) String

func ColorString added in v0.4.42

func ColorString(color *Color, format string, a ...interface{}) String

func CyanString

func CyanString(format string, a ...interface{}) String

func CyanUnderlineString

func CyanUnderlineString(format string, a ...interface{}) String

func GreenString

func GreenString(format string, a ...interface{}) String

func GreenUnderlineString

func GreenUnderlineString(format string, a ...interface{}) String

func ItalicString

func ItalicString(format string, a ...interface{}) String

func RedString

func RedString(format string, a ...interface{}) String

func RedUnderlineString

func RedUnderlineString(format string, a ...interface{}) String

func UnderlineString

func UnderlineString(format string, a ...interface{}) String

func YellowString

func YellowString(format string, a ...interface{}) String

func YellowUnderlineString

func YellowUnderlineString(format string, a ...interface{}) String

func (*String) ChangeColor

func (s *String) ChangeColor(newColor *Color)

func (String) Color

func (s String) Color() *Color

Color 返回底层颜色数据

func (String) Get

func (s String) Get(noColor bool) string

Get 返回字符串

func (String) GetForStderr

func (s String) GetForStderr() string

func (String) GetForStdout

func (s String) GetForStdout() string

func (String) Pure

func (s String) Pure() string

Pure 返回不包括颜色的底层字符串

func (String) WithColor added in v0.4.42

func (s String) WithColor(newColor *Color) String

func (String) Wrap

func (s String) Wrap() string

Wrap 返回添加了颜色头尾的底层字符串

Jump to

Keyboard shortcuts

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