color

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color int
const (
	FgBlack Color = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

字体颜色

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

背景色

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

字体颜色高亮

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

背景色高亮

type Colors

type Colors []Color

func NewColors

func NewColors(colors ...Color) Colors

func (Colors) Fprint

func (c Colors) Fprint(w io.Writer, a ...any) (n int, err error)

\033[字背景颜色;字体颜色m 字符串\033[0m

func (Colors) HasColors added in v0.1.2

func (c Colors) HasColors() bool

func (Colors) IntelligentPrint added in v0.1.20

func (c Colors) IntelligentPrint(a ...any)

如果终端不支持彩色,则使用原始方式打印

func (Colors) Sprint

func (c Colors) Sprint(a ...any) string

Jump to

Keyboard shortcuts

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