forked from daviddengcn/go-colortext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathct.go
37 lines (32 loc) · 834 Bytes
/
ct.go
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
/*
ct package provides functions to change the color of console text.
Under windows platform, the Console api is used. Under other systems, ANSI text mode is used.
*/
package ct
// Color is the type of color to be set.
type Color int
const (
// No change of color
None = Color(iota)
Black
Red
Green
Yellow
Blue
Magenta
Cyan
White
)
/*
ResetColor resets the foreground and background to original colors
*/
func ResetColor() {
resetColor()
}
// ChangeColor sets the foreground and background colors. If the value of the color is None,
// the corresponding color keeps unchanged.
// If fgBright or bgBright is set true, corresponding color use bright color. bgBright may be
// ignored in some OS environment.
func ChangeColor(fg Color, fgBright bool, bg Color, bgBright bool) {
changeColor(fg, fgBright, bg, bgBright)
}