Documentation
¶
Index ¶
Constants ¶
View Source
const ( // FgBlack 黑色 FgBlack attr = iota + 30 // FgRed 红色 FgRed // FgGreen 绿色 FgGreen // FgYellow 黄色 FgYellow // FgBlue 蓝色 FgBlue // FgMagenta 品红 FgMagenta // FgCyan 青色 FgCyan // FgWhite 白色 FgWhite )
View Source
const ( // Purple 紫色 Purple = 35 // Blue 蓝色 Blue = 34 )
Variables ¶
View Source
var ( // NoColor 关闭颜色开关 本行代码来自github.com/fatih/color, 感谢fatih的付出 NoColor = os.Getenv("TERM") == "dumb" || (!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd())) )
Functions ¶
This section is empty.
Types ¶
type Formatter ¶
type Formatter struct {
KeyColor *Color // 设置key的颜色
StringColor *Color // 设置string的颜色
BoolColor *Color // 设置bool的颜色
NumberColor *Color // 设置数字的颜色
NullColor *Color // 设置null的颜色
StringMaxLength int
Indent int
DisabledColor bool
RawStrings bool
// contains filtered or unexported fields
}
Formatter 是颜色高亮核心结构体
func NewFormatEncoder ¶
NewFormatEncoder 着色json/yaml/xml构造函数
Click to show internal directories.
Click to hide internal directories.