rainbow

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 3 Imported by: 0

README

rainbow

rainbow

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(colors Colors, args ...interface{})

func Printf

func Printf(colors Colors, f string, args ...interface{})

Printf 中的\n不能被正确的添加到颜色格式化串中 推荐封装额外的fmt.Print()使用

func Println

func Println(colors Colors, args ...interface{})

func ResetColor

func ResetColor()

ResetColor 重置颜色

func SetColor

func SetColor(c Color)

SetColor 设置颜色

Types

type Color

type Color int
const (
	Black Color = 30 + iota
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
	Gray
)

前景色

const (
	BGBlack Color = 40 + iota
	BGRed
	BGGreen
	BGYellow
	BGBlue
	BGMagenta
	BGCyan
	BGWhite
	BGGray
)

背景色

const (
	// Reset reset emphasis style
	Reset Color = iota
	// Bold bold emphasis style
	Bold
	// Dim dim emphasis style
	Dim
	// Italic italic emphasis style
	Italic
	// Underline underline emphasis style
	Underline
	// Blink blink emphasis style
	Blink

	// Inverse inverse emphasis style
	Inverse
	// Hidden hidden emphasis style
	Hidden
	// Strikeout strikeout emphasis style
	Strikeout
)

样式计算

func (Color) Fmt

func (color Color) Fmt() string

Fmt 生成单独的无样式颜色格式串

func (Color) FmtStyle

func (color Color) FmtStyle(style ...Color) string

FmtStyle 生成带样式的格式串 样式见calcType

func (Color) Print

func (color Color) Print(args ...interface{})

func (Color) Printf

func (color Color) Printf(f string, args ...interface{})

func (Color) Println

func (color Color) Println(args ...interface{})

func (Color) Raw

func (color Color) Raw() int

Raw 返回颜色对应的数字

func (Color) String

func (color Color) String() string

String 返回颜色字符串

type Colors

type Colors []Color

Jump to

Keyboard shortcuts

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