Select Graphic Rendition codes are a subset of the ANSI escape sequence codes and are used to add color and font attributes to the log console when running scripts. All sequences start with ESC [ (the control sequence introducer) followed by zero (0) or more codes separated by semicolons and closed with a lower case m. When scripting this looks like \x1b[33m
which would set the foreground text color yellow. See this example script:
// log a message using bold, bright red text on a bright white background and then reset the formatting
console.log('\x1b[1;91;107mTHIS IS VERY IMPORTANT TEXT!\x1b[0m and this is not...');
As you can see, the codes can be strung out separated by semicolons which makes coding the log entries very simple. See the table below for all supported codes in Limelight XE (version 2.2 and later).
Supported SGR Codes
Code |
Effect |
Comments |
0 |
Reset / Normal |
All attributes off |
1 |
Bold on |
Turns on the font bold attribute |
2 |
Bold off |
Turns off the font bold attribute |
3 |
Italic on |
Turns on the font italic attribute |
4 |
Underline On |
Turns on the font underline attribute (color follows text) |
5 - 8 |
(reserved) |
Not supported |
9 |
Strike on |
Turns on the font strike-out attribute |
10 - 20 |
(reserved) |
Not supported |
21 |
Bold off |
Turns off the font bold attribute (same as code 2) |
22 |
(reserved) |
Not supported |
23 |
Italic off |
Turns off the font italic attribute |
24 |
Underline off |
Not singly or doubly underlined |
25 - 28 |
(reserved) |
Not supported |
29 |
Strike off |
Turns off the font strike-out attribute |
30 - 37 |
Set foreground color |
See color table below |
38 |
Set foreground color |
Next arguments are 5;n or 2;r;g;b , see below |
39 |
Default foreground color |
Sets the color to default window text |
40 - 47 |
Set background color |
See color table below |
48 |
Set background color |
Next arguments are 5;n or 2;r;g;b , see below |
49 |
Default background color |
Sets the color to the default window |
50 - 89 |
(reserved) |
Not supported |
90–97 |
Set bright foreground color |
Sets the foreground color (see table below) |
100–107 |
Set bright background color |
Sets the background color (see table below) |
Standard Color Table
Name |
FG Code |
BG Code |
Color (decimal codes) |
Example |
Black |
30 |
40 |
0,0,0 |
console.log('\x1b[30;100mThis turns the foreground black with gray background'); |
Red |
31 |
41 |
128,0,0 |
console.log('\x1b[31mThis turns the foreground red'); |
Green |
32 |
42 |
0,128,0 |
console.log('\x1b[33;41mThis turns the foreground green with red background'); |
Yellow |
33 |
43 |
128,128,0 |
console.log('\x1b[33;107mThis turns the foreground yellow with white background'); |
Blue |
34 |
44 |
0,0,128 |
console.log('\x1b[34mThis turns the foreground blue'); |
Magenta |
35 |
45 |
128,0,128 |
console.log('\x1b[1;35mThis turns the foreground magenta with bold text'); |
Cyan |
36 |
46 |
0,128,128 |
console.log('\x1b[3;36mThis turns the foreground cyan with italic text'); |
White |
37 |
47 |
192,192,192 |
console.log('\x1b[37;41mThis turns the foreground white and the background red'); |
Bright Black (Gray) |
90 |
100 |
128,128,128 |
console.log('\x1b[97;100mThis turns the foreground bright white with gray background'); |
Bright Red |
91 |
101 |
255,0,0 |
console.log('\x1b[1;91mThis turns the foreground bright red with bold text'); |
Bright Green |
92 |
102 |
0,255,0 |
console.log('\x1b[92mThis turns the foreground bright green'); |
Bright Yellow |
93 |
103 |
255,255,0 |
console.log('\x1b[93mThis turns the foreground bright yellow'); |
Bright Blue |
94 |
104 |
0,0,255 |
console.log('\x1b[94mThis turns the foreground bright blue'); |
Bright Magenta |
95 |
105 |
255,0,255 |
console.log('\x1b[30;105mThis turns the foreground black and the background bright magenta'); |
Bright Cyan |
96 |
106 |
0,255,255 |
console.log('\x1b[96mThis turns the foreground bright cyan'); |
Bright White |
97 |
107 |
255,255,255 |
console.log('\x1b[91;107mThis turns the foreground bright red and the background bright white'); |
Extended Color Table (8 Bit)
256-color mode - foreground: ESC[38;5;#m background: ESC[48;5;#m where # is the code number below |
Standard colors |
High-intensity colors |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
|
216 colors |
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 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
Grayscale colors |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
|
Extended Color (24 Bit)
Limelight XE also supports a 24 bit (16,777,216 colors) mode often referred to as RGB mode. It has the format ESC[38;2;<R>;<G>;<B>m for foreground and ESC[48;2;<R>;<G>;<B>m for background. See examples below
// this message has R=255, G=140 and B=0 (Dark Orange) for foreground and R=255, G=228 and B=225 (Misty Rose) for background
console.log('\x1b[38;2;255;140;0;48;2;255;228;225mExample 24 bit color escape sequence\x1b[0m');