Documentation ¶
Overview ¶
Package ansi color code implementation for command line.
Base (original) library, independent of other packages (project library).
ANSI escape code ¶
Attempt to support powershell, bash ¶
ANSI # 前景色 # 30-37 为标准颜色,38;5;编号 为256色模式 # 示例:黑色、红色、绿色、黄色、蓝色、洋红、青色、白色
格式: `\033[<parameter1>;<parameter2>...<parameterN><letter>`
Link: https://worktile.com/kb/ask/452398.html, linux命令行输出颜色文本
关于\033中的\0在ANSI颜色码中,\033是一个八进制转义序列,代表ASCII字符集中的ESC(Escape)字符。 在ASCII表中,ESC字符的值为27(十进制),对应的八进制表示为033。因此,\033实际上是转义序列的一部分,用于引入ANSI颜色码。
var s = "xxxx" for i, e := range []rune(s) { fmt.Printf("%d -> %c\n", i, e) } \033 -> esc
Index ¶
Constants ¶
View Source
const ( // Black list of text base colors supported by the system library Black = 30 Red = 31 Green = 32 Yellow = 33 Blue = 34 Purple = 35 Cyan = 36 White = 37 // BlackBr Font Brightening BlackBr = 90 RedBr = 91 GreenBr = 92 YellowBr = 93 BlueBr = 94 PurpleBr = 95 CyanBr = 96 WhiteBr = 97 // BkgBlack font background color BkgBlack = 40 BkgRed = 41 BkgGreen = 42 BkgYellow = 43 BkgBlue = 44 BkgPurple = 45 BkgCyan = 46 BkgWhite = 47 // BkgBlackBr font background color and flicker BkgBlackBr = 100 BkgRedBr = 101 BkgGreenBr = 102 BkgYellowBr = 103 BkgBlueBr = 104 BkgPurpleBr = 105 BkgCyanBr = 106 BkgWhiteBr = 107 // Bold typeface specific style Bold = 1 Dim = 2 Italic = 3 Underline = 4 Twinkle = 5 Reverse = 6 Hide = 7 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.