2 Star 0 Fork 0

TeamsHub/backend-gopkg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
string_linux.go 863 Bytes
一键复制 编辑 原始数据 按行查看 历史
HCY 提交于 2024-05-10 12:41 +08:00 . c
// +build linux
package color
import (
"fmt"
"math/rand"
"strconv"
)
var _ = RandomColor()
// RandomColor generates a random color.
func RandomColor() string {
return fmt.Sprintf("#%s", strconv.FormatInt(int64(rand.Intn(16777216)), 16))
}
// Yellow ...
func Yellow(msg string) string {
return fmt.Sprintf("\x1b[33m%s\x1b[0m", msg)
}
// Red ...
func Red(msg string) string {
return fmt.Sprintf("\x1b[31m%s\x1b[0m", msg)
}
// Redf ...
func Redf(msg string, arg interface{}) string {
return fmt.Sprintf("\x1b[31m%s\x1b[0m %+v\n", msg, arg)
}
// Blue ...
func Blue(msg string) string {
return fmt.Sprintf("\x1b[34m%s\x1b[0m", msg)
}
// Green ...
func Green(msg string) string {
return fmt.Sprintf("\x1b[32m%s\x1b[0m", msg)
}
// Greenf ...
func Greenf(msg string, arg interface{}) string {
return fmt.Sprintf("\x1b[32m%s\x1b[0m %+v\n", msg, arg)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuzheng0709/backend-gopkg.git
git@gitee.com:wuzheng0709/backend-gopkg.git
wuzheng0709
backend-gopkg
backend-gopkg
v1.6.23

搜索帮助