4646 */
4747class Color
4848{
49- public const RESET = 0 ;
49+ public const RESET = 0 ;
5050
5151 public const NORMAL = 0 ;
5252
@@ -63,87 +63,87 @@ class Color
6363 public const BG_EXTRA = 100 ;
6464
6565 // Foreground color
66- public const FG_BLACK = 30 ;
66+ public const FG_BLACK = 30 ;
6767
68- public const FG_RED = 31 ;
68+ public const FG_RED = 31 ;
6969
70- public const FG_GREEN = 32 ;
70+ public const FG_GREEN = 32 ;
7171
72- public const FG_BROWN = 33 ; // like yellow
72+ public const FG_BROWN = 33 ; // like yellow
7373
74- public const FG_BLUE = 34 ;
74+ public const FG_BLUE = 34 ;
7575
76- public const FG_CYAN = 36 ;
76+ public const FG_CYAN = 36 ;
7777
78- public const FG_WHITE = 37 ;
78+ public const FG_WHITE = 37 ;
7979
8080 public const FG_DEFAULT = 39 ;
8181
8282 // extra Foreground color
83- public const FG_DARK_GRAY = 90 ;
83+ public const FG_DARK_GRAY = 90 ;
8484
85- public const FG_LIGHT_RED = 91 ;
85+ public const FG_LIGHT_RED = 91 ;
8686
87- public const FG_LIGHT_GREEN = 92 ;
87+ public const FG_LIGHT_GREEN = 92 ;
8888
89- public const FG_LIGHT_YELLOW = 93 ;
89+ public const FG_LIGHT_YELLOW = 93 ;
9090
91- public const FG_LIGHT_BLUE = 94 ;
91+ public const FG_LIGHT_BLUE = 94 ;
9292
9393 public const FG_LIGHT_MAGENTA = 95 ;
9494
95- public const FG_LIGHT_CYAN = 96 ;
95+ public const FG_LIGHT_CYAN = 96 ;
9696
97- public const FG_LIGHT_WHITE = 97 ;
97+ public const FG_LIGHT_WHITE = 97 ;
9898
9999 // Background color
100- public const BG_BLACK = 40 ;
100+ public const BG_BLACK = 40 ;
101101
102- public const BG_RED = 41 ;
102+ public const BG_RED = 41 ;
103103
104- public const BG_GREEN = 42 ;
104+ public const BG_GREEN = 42 ;
105105
106- public const BG_BROWN = 43 ; // like yellow
106+ public const BG_BROWN = 43 ; // like yellow
107107
108- public const BG_BLUE = 44 ;
108+ public const BG_BLUE = 44 ;
109109
110- public const BG_CYAN = 46 ;
110+ public const BG_CYAN = 46 ;
111111
112- public const BG_WHITE = 47 ;
112+ public const BG_WHITE = 47 ;
113113
114114 public const BG_DEFAULT = 49 ;
115115
116116 // extra Background color
117- public const BG_DARK_GRAY = 100 ;
117+ public const BG_DARK_GRAY = 100 ;
118118
119- public const BG_LIGHT_RED = 101 ;
119+ public const BG_LIGHT_RED = 101 ;
120120
121- public const BG_LIGHT_GREEN = 102 ;
121+ public const BG_LIGHT_GREEN = 102 ;
122122
123- public const BG_LIGHT_YELLOW = 103 ;
123+ public const BG_LIGHT_YELLOW = 103 ;
124124
125- public const BG_LIGHT_BLUE = 104 ;
125+ public const BG_LIGHT_BLUE = 104 ;
126126
127127 public const BG_LIGHT_MAGENTA = 105 ;
128128
129- public const BG_LIGHT_CYAN = 106 ;
129+ public const BG_LIGHT_CYAN = 106 ;
130130
131- public const BG_WHITE_W = 107 ;
131+ public const BG_WHITE_W = 107 ;
132132
133133 // color option
134- public const BOLD = 1 ; // 加粗
134+ public const BOLD = 1 ; // 加粗
135135
136- public const FUZZY = 2 ; // 模糊(不是所有的终端仿真器都支持)
136+ public const FUZZY = 2 ; // 模糊(不是所有的终端仿真器都支持)
137137
138- public const ITALIC = 3 ; // 斜体(不是所有的终端仿真器都支持)
138+ public const ITALIC = 3 ; // 斜体(不是所有的终端仿真器都支持)
139139
140140 public const UNDERSCORE = 4 ; // 下划线
141141
142- public const BLINK = 5 ; // 闪烁
142+ public const BLINK = 5 ; // 闪烁
143143
144- public const REVERSE = 7 ; // 颠倒的 交换背景色与前景色
144+ public const REVERSE = 7 ; // 颠倒的 交换背景色与前景色
145145
146- public const CONCEALED = 8 ; // 隐匿的
146+ public const CONCEALED = 8 ; // 隐匿的
147147
148148 /**
149149 * There are some internal styles
@@ -155,15 +155,19 @@ class Color
155155 // basic
156156 'normal ' => '39 ' ,// no color
157157 'red ' => '0;31 ' ,
158+ 'red1 ' => '1;31 ' ,
158159 'blue ' => '0;34 ' ,
159160 'cyan ' => '0;36 ' ,
161+ 'cyan1 ' => '1;36 ' ,
160162 'black ' => '0;30 ' ,
161163 'green ' => '0;32 ' ,
164+ 'green1 ' => '1;32 ' ,
162165 'brown ' => '0;33 ' ,
166+ 'brown1 ' => '1;33 ' ,
163167 'white ' => '1;37 ' ,
164168 'ylw0 ' => '0;33 ' ,
165- 'yellow0 ' => '0;33 ' ,
166169 'ylw ' => '1;33 ' ,
170+ 'yellow0 ' => '0;33 ' ,
167171 'yellow ' => '1;33 ' ,
168172 'mga0 ' => '0;35 ' ,
169173 'magenta0 ' => '0;35 ' ,
@@ -340,11 +344,11 @@ public static function render(string $text, $style = null): string
340344 if (is_string ($ style )) {
341345 $ color = self ::STYLES [$ style ] ?? '' ;
342346
343- // custom style: [self::FG_GREEN, self::BG_WHITE, self::UNDERSCORE]
347+ // custom style: [self::FG_GREEN, self::BG_WHITE, self::UNDERSCORE]
344348 } elseif (is_array ($ style )) {
345349 $ color = implode ('; ' , $ style );
346350
347- // user color tag: <info>message</info>
351+ // user color tag: <info>message</info>
348352 } elseif (strpos ($ text , '</ ' ) > 0 ) {
349353 return self ::parseTag ($ text );
350354 }
0 commit comments