-
Notifications
You must be signed in to change notification settings - Fork 1
/
color.go
156 lines (150 loc) · 5.03 KB
/
color.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package xlog
type ColorType string
var (
Reset = &reset
// 标准
White = &white
Red = &red
Green = &green
Yellow = &yellow
Blue = &blue
Magenta = &magenta
Cyan = &cyan
// 高亮
WhiteBright = &whiteBright
RedBright = &redBright
GreenBright = &greenBright
YellowBright = &yellowBright
BlueBright = &blueBright
MagentaBright = &magentaBright
CyanBright = &cyanBright
// 斜体
WhiteBevel = &whiteBevel
RedBevel = &redBevel
GreenBevel = &greenBevel
YellowBevel = &yellowBevel
BlueBevel = &blueBevel
MagentaBevel = &magentaBevel
CyanBevel = &cyanBevel
// 下划线
WhiteUnderLine = &whiteUnderLine
RedUnderLine = &redUnderLine
GreenUnderLine = &greenUnderLine
YellowUnderLine = &yellowUnderLine
BlueUnderLine = &blueUnderLine
MagentaUnderLine = &magentaUnderLine
CyanUnderLine = &cyanUnderLine
// 背景色
WhiteBg = &whiteBg
RedBg = &redBg
GreenBg = &greenBg
YellowBg = &yellowBg
BlueBg = &blueBg
MagentaBg = &magentaBg
CyanBg = &cyanBg
// 删除线
WhiteDelLine = &whiteDelLine
RedDelLine = &redDelLine
GreenDelLine = &greenDelLine
YellowDelLine = &yellowDelLine
BlueDelLine = &blueDelLine
MagentaDelLine = &magentaDelLine
CyanDelLine = &cyanDelLine
// ================================================
reset = ColorType([]byte{27, 91, 48, 109})
// 标准
white = ColorType([]byte{27, 91, 51, 48, 109}) // 白色
red = ColorType([]byte{27, 91, 51, 49, 109}) // 红色
green = ColorType([]byte{27, 91, 51, 50, 109}) // 绿色
yellow = ColorType([]byte{27, 91, 51, 51, 109}) // 黄色
blue = ColorType([]byte{27, 91, 51, 52, 109}) // 蓝色
magenta = ColorType([]byte{27, 91, 51, 53, 109}) // 紫色
cyan = ColorType([]byte{27, 91, 51, 54, 109}) // 青色
// 高亮
whiteBright = ColorType([]byte{27, 91, 49, 59, 51, 48, 109})
redBright = ColorType([]byte{27, 91, 49, 59, 51, 49, 109})
greenBright = ColorType([]byte{27, 91, 49, 59, 51, 50, 109})
yellowBright = ColorType([]byte{27, 91, 49, 59, 51, 51, 109})
blueBright = ColorType([]byte{27, 91, 49, 59, 51, 52, 109})
magentaBright = ColorType([]byte{27, 91, 49, 59, 51, 53, 109})
cyanBright = ColorType([]byte{27, 91, 49, 59, 51, 54, 109})
// 斜体
whiteBevel = ColorType([]byte{27, 91, 51, 59, 51, 48, 109})
redBevel = ColorType([]byte{27, 91, 51, 59, 51, 49, 109})
greenBevel = ColorType([]byte{27, 91, 51, 59, 51, 50, 109})
yellowBevel = ColorType([]byte{27, 91, 51, 59, 51, 51, 109})
blueBevel = ColorType([]byte{27, 91, 51, 59, 51, 52, 109})
magentaBevel = ColorType([]byte{27, 91, 51, 59, 51, 53, 109})
cyanBevel = ColorType([]byte{27, 91, 51, 59, 51, 54, 109})
// 下划线
whiteUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 48, 109})
redUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 49, 109})
greenUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 50, 109})
yellowUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 51, 109})
blueUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 52, 109})
magentaUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 53, 109})
cyanUnderLine = ColorType([]byte{27, 91, 52, 59, 51, 54, 109})
// 背景色
whiteBg = ColorType([]byte{27, 91, 55, 59, 51, 48, 109})
redBg = ColorType([]byte{27, 91, 55, 59, 51, 49, 109})
greenBg = ColorType([]byte{27, 91, 55, 59, 51, 50, 109})
yellowBg = ColorType([]byte{27, 91, 55, 59, 51, 51, 109})
blueBg = ColorType([]byte{27, 91, 55, 59, 51, 52, 109})
magentaBg = ColorType([]byte{27, 91, 55, 59, 51, 53, 109})
cyanBg = ColorType([]byte{27, 91, 55, 59, 51, 54, 109})
// 删除线
whiteDelLine = ColorType([]byte{27, 91, 57, 59, 51, 48, 109})
redDelLine = ColorType([]byte{27, 91, 57, 59, 51, 49, 109})
greenDelLine = ColorType([]byte{27, 91, 57, 59, 51, 50, 109})
yellowDelLine = ColorType([]byte{27, 91, 57, 59, 51, 51, 109})
blueDelLine = ColorType([]byte{27, 91, 57, 59, 51, 52, 109})
magentaDelLine = ColorType([]byte{27, 91, 57, 59, 51, 53, 109})
cyanDelLine = ColorType([]byte{27, 91, 57, 59, 51, 54, 109})
)
//var cl *ColorLogger
//type ColorLogger struct {
// Color *ColorType
//}
//
//func Color(color *ColorType) *ColorLogger {
// if cl == nil {
// cl = &ColorLogger{
// Color: color,
// }
// return cl
// }
// cl.Color = color
// return cl
//}
//
//func (l *ColorLogger) Info(args ...any) {
// l.i.LogOut(l.Color, nil, args...)
//}
//
//func (l *ColorLogger) Infof(format string, args ...any) {
// l.i.LogOut(l.Color, &format, args...)
//}
//
//func (l *ColorLogger) Debug(args ...any) {
// l.d.LogOut(l.Color, nil, args...)
//}
//
//func (l *ColorLogger) Debugf(format string, args ...any) {
// l.d.LogOut(l.Color, &format, args...)
//}
//
//func (l *ColorLogger) Warn(args ...any) {
// l.w.LogOut(l.Color, nil, args...)
//}
//
//func (l *ColorLogger) Warnf(format string, args ...any) {
// l.w.LogOut(l.Color, &format, args...)
//}
//
//func (l *ColorLogger) Error(args ...any) {
// l.e.LogOut(l.Color, nil, args...)
//}
//
//func (l *ColorLogger) Errorf(format string, args ...any) {
// l.e.LogOut(l.Color, &format, args...)
//}