代码拉取完成,页面将自动刷新
package fun
import (
"fmt"
)
// 前景 背景 颜色
// ---------------------------------------
// 30 40 黑色
// 31 41 红色
// 32 42 绿色
// 33 43 黄色
// 34 44 蓝色
// 35 45 紫红色
// 36 46 青蓝色
// 37 47 白色
//
// 代码 意义
// -------------------------
// 0 终端默认设置
// 1 高亮显示
// 4 使用下划线
// 5 闪烁
// 7 反白显示
// 8 不可见
const (
COLOR_BLACK = iota + 30
COLOR_RED
COLOR_GREEN
COLOR_YELLOW
COLOR_BLUE
COLOR_MAGENTA
COLOR_CYAN
COLOR_WHITE
)
// 黑色
func ColorBlack(msg string) string {
return Color(msg, 0, 0, COLOR_BLACK)
}
// 红色
func ColorRed(msg string) string {
return Color(msg, 0, 0, COLOR_RED)
}
// 绿色
func ColorGreen(msg string) string {
return Color(msg, 0, 0, COLOR_GREEN)
}
// 黄色
func ColorYellow(msg string) string {
return Color(msg, 0, 0, COLOR_YELLOW)
}
// 蓝色
func ColorBlue(msg string) string {
return Color(msg, 0, 0, COLOR_BLUE)
}
// 洋红色
func ColorMagenta(msg string) string {
return Color(msg, 0, 0, COLOR_MAGENTA)
}
// 青色
func ColorCyan(msg string) string {
return Color(msg, 0, 0, COLOR_CYAN)
}
// 白色
func ColorWhite(msg string) string {
return Color(msg, 0, 0, COLOR_WHITE)
}
// 获取文本颜色
func Color(msg string, conf, bg, text int) string {
return fmt.Sprintf("%c[%d;%d;%dm%s%c[0m", 0x1B, conf, bg, text, msg, 0x1B)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。