ansi-html-stream
ansi-html-stream copied to clipboard
Complete 256 Color Support
Currently ansi-html supports only some colors. There is no support for all 256 colors, which is supported by many terminal emulators. When one tries to use unsupported colors, they do not get converted properly:
python -c "for i in range(255): print i, '\033[48;5;%im' % i + ' ' + '\033[0m'" | ansi-html
<pre style="background-color:#000; color:#fff; padding:2em; overflow-x:scroll; max-width:80em">
0
1 <span style="font-weight:bold"> </span>
2
3
4 <span style="text-decoration:underline"> </span>
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 <span style="color:#111"> </span>
31 <span style="color:#ff7e76"> </span>
32 <span style="color:#a4f87b"> </span>
33 <span style="color:#f6fcc0"> </span>
34 <span style="color:#9cd8fb"> </span>
35 <span style="color:#ff85f6"> </span>
36 <span style="color:#cfd0f8"> </span>
37 <span style="color:#eee"> </span>
38
39
40 <span style="background-color:#111"> </span>
41 <span style="background-color:#ff7e76"> </span>
42 <span style="background-color:#a4f87b"> </span>
43 <span style="background-color:#f6fcc0"> </span>
44 <span style="background-color:#9cd8fb"> </span>
45 <span style="background-color:#ff85f6"> </span>
46 <span style="background-color:#cfd0f8"> </span>
47 <span style="background-color:#eee"> </span>
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
</pre>
@Bengt would you be able to send a pull request for this?
Sorry, I am not that familiar with Javascript, but I managed to adapt a gist to print out all HTML codes for the 6x6x6 color cube. I hope this is correct and helpful.
The output as an image with colors is:
Plaintext output:
[bengt@bengt-ssd 4ce622847577dbed351a]$ python term_colors.py
System colors:
RGB color cube, 6x6x6:
16 - #000000
17 - #000033
18 - #000066
19 - #000099
20 - #0000cc
21 - #0000ff
22 - #003300
23 - #003333
24 - #003366
25 - #003399
26 - #0033cc
27 - #0033ff
28 - #006600
29 - #006633
30 - #006666
31 - #006699
32 - #0066cc
33 - #0066ff
34 - #009900
35 - #009933
36 - #009966
37 - #009999
38 - #0099cc
39 - #0099ff
40 - #00cc00
41 - #00cc33
42 - #00cc66
43 - #00cc99
44 - #00cccc
45 - #00ccff
46 - #00ff00
47 - #00ff33
48 - #00ff66
49 - #00ff99
50 - #00ffcc
51 - #00ffff
52 - #330000
53 - #330033
54 - #330066
55 - #330099
56 - #3300cc
57 - #3300ff
58 - #333300
59 - #333333
60 - #333366
61 - #333399
62 - #3333cc
63 - #3333ff
64 - #336600
65 - #336633
66 - #336666
67 - #336699
68 - #3366cc
69 - #3366ff
70 - #339900
71 - #339933
72 - #339966
73 - #339999
74 - #3399cc
75 - #3399ff
76 - #33cc00
77 - #33cc33
78 - #33cc66
79 - #33cc99
80 - #33cccc
81 - #33ccff
82 - #33ff00
83 - #33ff33
84 - #33ff66
85 - #33ff99
86 - #33ffcc
87 - #33ffff
88 - #660000
89 - #660033
90 - #660066
91 - #660099
92 - #6600cc
93 - #6600ff
94 - #663300
95 - #663333
96 - #663366
97 - #663399
98 - #6633cc
99 - #6633ff
100 - #666600
101 - #666633
102 - #666666
103 - #666699
104 - #6666cc
105 - #6666ff
106 - #669900
107 - #669933
108 - #669966
109 - #669999
110 - #6699cc
111 - #6699ff
112 - #66cc00
113 - #66cc33
114 - #66cc66
115 - #66cc99
116 - #66cccc
117 - #66ccff
118 - #66ff00
119 - #66ff33
120 - #66ff66
121 - #66ff99
122 - #66ffcc
123 - #66ffff
124 - #990000
125 - #990033
126 - #990066
127 - #990099
128 - #9900cc
129 - #9900ff
130 - #993300
131 - #993333
132 - #993366
133 - #993399
134 - #9933cc
135 - #9933ff
136 - #996600
137 - #996633
138 - #996666
139 - #996699
140 - #9966cc
141 - #9966ff
142 - #999900
143 - #999933
144 - #999966
145 - #999999
146 - #9999cc
147 - #9999ff
148 - #99cc00
149 - #99cc33
150 - #99cc66
151 - #99cc99
152 - #99cccc
153 - #99ccff
154 - #99ff00
155 - #99ff33
156 - #99ff66
157 - #99ff99
158 - #99ffcc
159 - #99ffff
160 - #cc0000
161 - #cc0033
162 - #cc0066
163 - #cc0099
164 - #cc00cc
165 - #cc00ff
166 - #cc3300
167 - #cc3333
168 - #cc3366
169 - #cc3399
170 - #cc33cc
171 - #cc33ff
172 - #cc6600
173 - #cc6633
174 - #cc6666
175 - #cc6699
176 - #cc66cc
177 - #cc66ff
178 - #cc9900
179 - #cc9933
180 - #cc9966
181 - #cc9999
182 - #cc99cc
183 - #cc99ff
184 - #cccc00
185 - #cccc33
186 - #cccc66
187 - #cccc99
188 - #cccccc
189 - #ccccff
190 - #ccff00
191 - #ccff33
192 - #ccff66
193 - #ccff99
194 - #ccffcc
195 - #ccffff
196 - #ff0000
197 - #ff0033
198 - #ff0066
199 - #ff0099
200 - #ff00cc
201 - #ff00ff
202 - #ff3300
203 - #ff3333
204 - #ff3366
205 - #ff3399
206 - #ff33cc
207 - #ff33ff
208 - #ff6600
209 - #ff6633
210 - #ff6666
211 - #ff6699
212 - #ff66cc
213 - #ff66ff
214 - #ff9900
215 - #ff9933
216 - #ff9966
217 - #ff9999
218 - #ff99cc
219 - #ff99ff
220 - #ffcc00
221 - #ffcc33
222 - #ffcc66
223 - #ffcc99
224 - #ffcccc
225 - #ffccff
226 - #ffff00
227 - #ffff33
228 - #ffff66
229 - #ffff99
230 - #ffffcc
231 - #ffffff
Grayscale ramp, with RGB grays:
232 - #000000
233 - #101010
234 - #202020
235 - #303030
236 - #404040
237 - #505050
238 - #606060
239 - #707070
240 - #808080
241 - #909090
242 - #a0a0a0
243 - #b0b0b0
244 - #c0c0c0
245 - #d0d0d0
246 - #e0e0e0
247 - #f0f0f0
248 - #101010
249 - #111111
250 - #121212
251 - #131313
252 - #141414
253 - #151515
254 - #161616
255 - #171717
[bengt@bengt-ssd 4ce622847577dbed351a]$