2 Star 0 Fork 0

TeamsHub/backend-gopkg

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
string_linux.go 863 Bytes
Copy Edit Raw Blame History
HCY authored 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.4.12

Search