@@ -37,53 +37,53 @@ class Color
37
37
const NORMAL = 0 ;
38
38
39
39
// Foreground color
40
- const FG_BLACK = 30 ;
41
- const FG_RED = 31 ;
42
- const FG_GREEN = 32 ;
43
- const FG_BROWN = 33 ; // like yellow
44
- const FG_BLUE = 34 ;
45
- const FG_CYAN = 36 ;
46
- const FG_WHITE = 37 ;
40
+ const FG_BLACK = 30 ;
41
+ const FG_RED = 31 ;
42
+ const FG_GREEN = 32 ;
43
+ const FG_BROWN = 33 ; // like yellow
44
+ const FG_BLUE = 34 ;
45
+ const FG_CYAN = 36 ;
46
+ const FG_WHITE = 37 ;
47
47
const FG_DEFAULT = 39 ;
48
48
49
49
// extra Foreground color
50
- const FG_DARK_GRAY = 90 ;
51
- const FG_LIGHT_RED = 91 ;
52
- const FG_LIGHT_GREEN = 92 ;
53
- const FG_LIGHT_YELLOW = 93 ;
54
- const FG_LIGHT_BLUE = 94 ;
50
+ const FG_DARK_GRAY = 90 ;
51
+ const FG_LIGHT_RED = 91 ;
52
+ const FG_LIGHT_GREEN = 92 ;
53
+ const FG_LIGHT_YELLOW = 93 ;
54
+ const FG_LIGHT_BLUE = 94 ;
55
55
const FG_LIGHT_MAGENTA = 95 ;
56
- const FG_LIGHT_CYAN = 96 ;
57
- const FG_WHITE_W = 97 ;
56
+ const FG_LIGHT_CYAN = 96 ;
57
+ const FG_WHITE_W = 97 ;
58
58
59
59
// Background color
60
- const BG_BLACK = 40 ;
61
- const BG_RED = 41 ;
62
- const BG_GREEN = 42 ;
63
- const BG_BROWN = 43 ; // like yellow
64
- const BG_BLUE = 44 ;
65
- const BG_CYAN = 46 ;
66
- const BG_WHITE = 47 ;
60
+ const BG_BLACK = 40 ;
61
+ const BG_RED = 41 ;
62
+ const BG_GREEN = 42 ;
63
+ const BG_BROWN = 43 ; // like yellow
64
+ const BG_BLUE = 44 ;
65
+ const BG_CYAN = 46 ;
66
+ const BG_WHITE = 47 ;
67
67
const BG_DEFAULT = 49 ;
68
68
69
69
// extra Background color
70
- const BG_DARK_GRAY = 100 ;
71
- const BG_LIGHT_RED = 101 ;
72
- const BG_LIGHT_GREEN = 102 ;
73
- const BG_LIGHT_YELLOW = 103 ;
74
- const BG_LIGHT_BLUE = 104 ;
70
+ const BG_DARK_GRAY = 100 ;
71
+ const BG_LIGHT_RED = 101 ;
72
+ const BG_LIGHT_GREEN = 102 ;
73
+ const BG_LIGHT_YELLOW = 103 ;
74
+ const BG_LIGHT_BLUE = 104 ;
75
75
const BG_LIGHT_MAGENTA = 105 ;
76
- const BG_LIGHT_CYAN = 106 ;
77
- const BG_WHITE_W = 107 ;
76
+ const BG_LIGHT_CYAN = 106 ;
77
+ const BG_WHITE_W = 107 ;
78
78
79
79
// color option
80
- const BOLD = 1 ; // 加粗
81
- const FUZZY = 2 ; // 模糊(不是所有的终端仿真器都支持)
82
- const ITALIC = 3 ; // 斜体(不是所有的终端仿真器都支持)
80
+ const BOLD = 1 ; // 加粗
81
+ const FUZZY = 2 ; // 模糊(不是所有的终端仿真器都支持)
82
+ const ITALIC = 3 ; // 斜体(不是所有的终端仿真器都支持)
83
83
const UNDERSCORE = 4 ; // 下划线
84
- const BLINK = 5 ; // 闪烁
85
- const REVERSE = 7 ; // 颠倒的 交换背景色与前景色
86
- const CONCEALED = 8 ; // 隐匿的
84
+ const BLINK = 5 ; // 闪烁
85
+ const REVERSE = 7 ; // 颠倒的 交换背景色与前景色
86
+ const CONCEALED = 8 ; // 隐匿的
87
87
88
88
/**
89
89
* some styles
@@ -92,65 +92,65 @@ class Color
92
92
*/
93
93
const STYLES = [
94
94
// basic
95
- 'red ' => '0;31 ' ,
96
- 'blue ' => '0;34 ' ,
97
- 'cyan ' => '0;36 ' ,
98
- 'black ' => '0;30 ' ,
99
- 'green ' => '0;32 ' ,
100
- 'brown ' => '0;33 ' ,
101
- 'white ' => '1;37 ' ,
102
- 'normal ' => '39 ' ,// no color
103
- 'yellow ' => '1;33 ' ,
104
- 'magenta ' => '1;35 ' ,
95
+ 'red ' => '0;31 ' ,
96
+ 'blue ' => '0;34 ' ,
97
+ 'cyan ' => '0;36 ' ,
98
+ 'black ' => '0;30 ' ,
99
+ 'green ' => '0;32 ' ,
100
+ 'brown ' => '0;33 ' ,
101
+ 'white ' => '1;37 ' ,
102
+ 'normal ' => '39 ' ,// no color
103
+ 'yellow ' => '1;33 ' ,
104
+ 'magenta ' => '1;35 ' ,
105
105
106
106
// alert
107
- 'suc ' => '1;32 ' ,// same 'green' and 'bold'
108
- 'success ' => '1;32 ' ,
109
- 'info ' => '0;32 ' ,// same 'green'
110
- 'comment ' => '0;33 ' ,// same 'brown'
111
- 'note ' => '36;1 ' ,
112
- 'notice ' => '36;4 ' ,
113
- 'warn ' => '0;30;43 ' ,
114
- 'warning ' => '0;30;43 ' ,
115
- 'danger ' => '0;31 ' ,// same 'red'
116
- 'err ' => '30;41 ' ,
117
- 'error ' => '30;41 ' ,
107
+ 'suc ' => '1;32 ' ,// same 'green' and 'bold'
108
+ 'success ' => '1;32 ' ,
109
+ 'info ' => '0;32 ' ,// same 'green'
110
+ 'comment ' => '0;33 ' ,// same 'brown'
111
+ 'note ' => '36;1 ' ,
112
+ 'notice ' => '36;4 ' ,
113
+ 'warn ' => '0;30;43 ' ,
114
+ 'warning ' => '0;30;43 ' ,
115
+ 'danger ' => '0;31 ' ,// same 'red'
116
+ 'err ' => '30;41 ' ,
117
+ 'error ' => '30;41 ' ,
118
118
119
119
// more
120
- 'lightRed ' => '1;31 ' ,
121
- 'light_red ' => '1;31 ' ,
122
- 'lightGreen ' => '1;32 ' ,
120
+ 'lightRed ' => '1;31 ' ,
121
+ 'light_red ' => '1;31 ' ,
122
+ 'lightGreen ' => '1;32 ' ,
123
123
'light_green ' => '1;32 ' ,
124
- 'lightBlue ' => '1;34 ' ,
125
- 'light_blue ' => '1;34 ' ,
126
- 'lightCyan ' => '1;36 ' ,
127
- 'light_cyan ' => '1;36 ' ,
128
- 'lightDray ' => '37 ' ,
129
- 'light_gray ' => '37 ' ,
130
-
131
- 'darkDray ' => '90 ' ,
132
- 'dark_gray ' => '90 ' ,
133
- 'lightYellow ' => '93 ' ,
134
- 'light_yellow ' => '93 ' ,
135
- 'lightMagenta ' => '95 ' ,
136
- 'light_magenta ' => '95 ' ,
124
+ 'lightBlue ' => '1;34 ' ,
125
+ 'light_blue ' => '1;34 ' ,
126
+ 'lightCyan ' => '1;36 ' ,
127
+ 'light_cyan ' => '1;36 ' ,
128
+ 'lightDray ' => '37 ' ,
129
+ 'light_gray ' => '37 ' ,
130
+
131
+ 'darkDray ' => '90 ' ,
132
+ 'dark_gray ' => '90 ' ,
133
+ 'lightYellow ' => '93 ' ,
134
+ 'light_yellow ' => '93 ' ,
135
+ 'lightMagenta ' => '95 ' ,
136
+ 'light_magenta ' => '95 ' ,
137
137
138
138
// extra
139
- 'lightRedEx ' => '91 ' ,
140
- 'light_red_ex ' => '91 ' ,
141
- 'lightGreenEx ' => '92 ' ,
139
+ 'lightRedEx ' => '91 ' ,
140
+ 'light_red_ex ' => '91 ' ,
141
+ 'lightGreenEx ' => '92 ' ,
142
142
'light_green_ex ' => '92 ' ,
143
- 'lightBlueEx ' => '94 ' ,
144
- 'light_blue_ex ' => '94 ' ,
145
- 'lightCyanEx ' => '96 ' ,
146
- 'light_cyan_ex ' => '96 ' ,
147
- 'whiteEx ' => '97 ' ,
148
- 'white_ex ' => '97 ' ,
143
+ 'lightBlueEx ' => '94 ' ,
144
+ 'light_blue_ex ' => '94 ' ,
145
+ 'lightCyanEx ' => '96 ' ,
146
+ 'light_cyan_ex ' => '96 ' ,
147
+ 'whiteEx ' => '97 ' ,
148
+ 'white_ex ' => '97 ' ,
149
149
150
150
// option
151
- 'bold ' => '1 ' ,
152
- 'underscore ' => '4 ' ,
153
- 'reverse ' => '7 ' ,
151
+ 'bold ' => '1 ' ,
152
+ 'underscore ' => '4 ' ,
153
+ 'reverse ' => '7 ' ,
154
154
];
155
155
156
156
/**
@@ -170,7 +170,7 @@ class Color
170
170
171
171
/**
172
172
* @param string $method
173
- * @param array $args
173
+ * @param array $args
174
174
* @return string
175
175
*/
176
176
public static function __callStatic ($ method , array $ args )
@@ -199,7 +199,7 @@ public static function apply(string $style, string $text): string
199
199
200
200
/**
201
201
* render text
202
- * @param string $text
202
+ * @param string $text
203
203
* @param string|array $style
204
204
* - string: 'green', 'blue'
205
205
* - array: [Color::FG_GREEN, Color::BG_WHITE, Color::UNDERSCORE]
@@ -287,7 +287,7 @@ public static function wrapTag(string $string, string $tag): string
287
287
288
288
/**
289
289
* @param string $text
290
- * @param bool $stripTag
290
+ * @param bool $stripTag
291
291
* @return string
292
292
*/
293
293
public static function clearColor (string $ text , bool $ stripTag = true ): string
0 commit comments