-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolorprint.go
More file actions
40 lines (32 loc) · 783 Bytes
/
colorprint.go
File metadata and controls
40 lines (32 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* // Copyright (c) 2020 @thiinbit. All rights reserved.
* // Use of this source code is governed by an MIT-style
* // license that can be found in the LICENSE file
*
*/
package gosocket
import (
"fmt"
)
const (
colorRed = uint8(iota + 91)
colorGreen
colorYellow
colorBlue
colorMagenta //洋红
)
func Red(s interface{}) string {
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", colorRed, s)
}
func Green(s interface{}) string {
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", colorGreen, s)
}
func Yellow(s interface{}) string {
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", colorYellow, s)
}
func Blue(s interface{}) string {
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", colorBlue, s)
}
func Magenta(s interface{}) string {
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", colorMagenta, s)
}