hex256 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/hex256.rb +519 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b79c5d7da0fe2e6a658f82819fee8cd3478d54b7
4
+ data.tar.gz: 797197da119957ad5dee0e4ac1530580293ada75
5
+ SHA512:
6
+ metadata.gz: a3fd4b98977ef9d5cb69d01d4d013609d972b9efa1d7daa551a96b89e80a362f659c0a9d83b70c3e00bbf36a51c7c8348fc69e4fec84a720bbc1e5b0e17cdfd3
7
+ data.tar.gz: a3a1983a2319e550cc4cd2e99a05035dfdf68dcacfdfe88bd893f730e0b1f7bf410b7adc55e6b8481b730436d3f9a4b0add90c185b1951ad17e328b5227ad022
data/lib/hex256.rb ADDED
@@ -0,0 +1,519 @@
1
+ class HexConverter
2
+ def self.ansi_to_hex(ansi)
3
+ case ansi.to_i
4
+ when 0
5
+ hex = '000000'
6
+ when 1
7
+ hex = '800000'
8
+ when 2
9
+ hex = '008000'
10
+ when 3
11
+ hex = '808000'
12
+ when 4
13
+ hex = '000080'
14
+ when 5
15
+ hex = '800080'
16
+ when 6
17
+ hex = '008080'
18
+ when 7
19
+ hex = 'c0c0c0'
20
+ when 8
21
+ hex = '808080'
22
+ when 9
23
+ hex = 'ff0000'
24
+ when 10
25
+ hex = '00ff00'
26
+ when 11
27
+ hex = 'ffff00'
28
+ when 12
29
+ hex = '0000ff'
30
+ when 13
31
+ hex = 'ff00ff'
32
+ when 14
33
+ hex = '00ffff'
34
+ when 15
35
+ hex = 'ffffff'
36
+ when 16
37
+ hex = '000000'
38
+ when 17
39
+ hex = '00005f'
40
+ when 18
41
+ hex = '000087'
42
+ when 19
43
+ hex = '0000af'
44
+ when 20
45
+ hex = '0000d7'
46
+ when 21
47
+ hex = '0000ff'
48
+ when 22
49
+ hex = '005f00'
50
+ when 23
51
+ hex = '005f5f'
52
+ when 24
53
+ hex = '005f87'
54
+ when 25
55
+ hex = '005faf'
56
+ when 26
57
+ hex = '005fd7'
58
+ when 27
59
+ hex = '005fff'
60
+ when 28
61
+ hex = '008700'
62
+ when 29
63
+ hex = '00875f'
64
+ when 30
65
+ hex = '008787'
66
+ when 31
67
+ hex = '0087af'
68
+ when 32
69
+ hex = '0087d7'
70
+ when 33
71
+ hex = '0087ff'
72
+ when 34
73
+ hex = '00af00'
74
+ when 35
75
+ hex = '00af5f'
76
+ when 36
77
+ hex = '00af87'
78
+ when 37
79
+ hex = '00afaf'
80
+ when 38
81
+ hex = '00afd7'
82
+ when 39
83
+ hex = '00afff'
84
+ when 40
85
+ hex = '00d700'
86
+ when 41
87
+ hex = '00d75f'
88
+ when 42
89
+ hex = '00d787'
90
+ when 43
91
+ hex = '00d7af'
92
+ when 44
93
+ hex = '00d7d7'
94
+ when 45
95
+ hex = '00d7ff'
96
+ when 46
97
+ hex = '00ff00'
98
+ when 47
99
+ hex = '00ff5f'
100
+ when 48
101
+ hex = '00ff87'
102
+ when 49
103
+ hex = '00ffaf'
104
+ when 50
105
+ hex = '00ffd7'
106
+ when 51
107
+ hex = '00ffff'
108
+ when 52
109
+ hex = '5f0000'
110
+ when 53
111
+ hex = '5f005f'
112
+ when 54
113
+ hex = '5f0087'
114
+ when 55
115
+ hex = '5f00af'
116
+ when 56
117
+ hex = '5f00d7'
118
+ when 57
119
+ hex = '5f00ff'
120
+ when 58
121
+ hex = '5f5f00'
122
+ when 59
123
+ hex = '5f5f5f'
124
+ when 60
125
+ hex = '5f5f87'
126
+ when 61
127
+ hex = '5f5faf'
128
+ when 62
129
+ hex = '5f5fd7'
130
+ when 63
131
+ hex = '5f5fff'
132
+ when 64
133
+ hex = '5f8700'
134
+ when 65
135
+ hex = '5f875f'
136
+ when 66
137
+ hex = '5f8787'
138
+ when 67
139
+ hex = '5f87af'
140
+ when 68
141
+ hex = '5f87d7'
142
+ when 69
143
+ hex = '5f87ff'
144
+ when 70
145
+ hex = '5faf00'
146
+ when 71
147
+ hex = '5faf5f'
148
+ when 72
149
+ hex = '5faf87'
150
+ when 73
151
+ hex = '5fafaf'
152
+ when 74
153
+ hex = '5fafd7'
154
+ when 75
155
+ hex = '5fafff'
156
+ when 76
157
+ hex = '5fd700'
158
+ when 77
159
+ hex = '5fd75f'
160
+ when 78
161
+ hex = '5fd787'
162
+ when 79
163
+ hex = '5fd7af'
164
+ when 80
165
+ hex = '5fd7d7'
166
+ when 81
167
+ hex = '5fd7ff'
168
+ when 82
169
+ hex = '5fff00'
170
+ when 83
171
+ hex = '5fff5f'
172
+ when 84
173
+ hex = '5fff87'
174
+ when 85
175
+ hex = '5fffaf'
176
+ when 86
177
+ hex = '5fffd7'
178
+ when 87
179
+ hex = '5fffff'
180
+ when 88
181
+ hex = '870000'
182
+ when 89
183
+ hex = '87005f'
184
+ when 90
185
+ hex = '870087'
186
+ when 91
187
+ hex = '8700af'
188
+ when 92
189
+ hex = '8700d7'
190
+ when 93
191
+ hex = '8700ff'
192
+ when 94
193
+ hex = '875f00'
194
+ when 95
195
+ hex = '875f5f'
196
+ when 96
197
+ hex = '875f87'
198
+ when 97
199
+ hex = '875faf'
200
+ when 98
201
+ hex = '875fd7'
202
+ when 99
203
+ hex = '875fff'
204
+ when 100
205
+ hex = '878700'
206
+ when 101
207
+ hex = '87875f'
208
+ when 102
209
+ hex = '878787'
210
+ when 103
211
+ hex = '8787af'
212
+ when 104
213
+ hex = '8787d7'
214
+ when 105
215
+ hex = '8787ff'
216
+ when 106
217
+ hex = '87af00'
218
+ when 107
219
+ hex = '87af5f'
220
+ when 108
221
+ hex = '87af87'
222
+ when 109
223
+ hex = '87afaf'
224
+ when 110
225
+ hex = '87afd7'
226
+ when 111
227
+ hex = '87afff'
228
+ when 112
229
+ hex = '87d700'
230
+ when 113
231
+ hex = '87d75f'
232
+ when 114
233
+ hex = '87d787'
234
+ when 115
235
+ hex = '87d7af'
236
+ when 116
237
+ hex = '87d7d7'
238
+ when 117
239
+ hex = '87d7ff'
240
+ when 118
241
+ hex = '87ff00'
242
+ when 119
243
+ hex = '87ff5f'
244
+ when 120
245
+ hex = '87ff87'
246
+ when 121
247
+ hex = '87ffaf'
248
+ when 122
249
+ hex = '87ffd7'
250
+ when 123
251
+ hex = '87ffff'
252
+ when 124
253
+ hex = 'af0000'
254
+ when 125
255
+ hex = 'af005f'
256
+ when 126
257
+ hex = 'af0087'
258
+ when 127
259
+ hex = 'af00af'
260
+ when 128
261
+ hex = 'af00d7'
262
+ when 129
263
+ hex = 'af00af'
264
+ when 130
265
+ hex = 'af5f00'
266
+ when 131
267
+ hex = 'af5f5f'
268
+ when 132
269
+ hex = 'af5f87'
270
+ when 133
271
+ hex = 'af5faf'
272
+ when 134
273
+ hex = 'af5fd7'
274
+ when 135
275
+ hex = 'af5fff'
276
+ when 136
277
+ hex = 'af8700'
278
+ when 137
279
+ hex = 'af875f'
280
+ when 138
281
+ hex = 'af8787'
282
+ when 139
283
+ hex = 'af87af'
284
+ when 140
285
+ hex = 'af87d7'
286
+ when 141
287
+ hex = 'af87ff'
288
+ when 142
289
+ hex = 'afaf00'
290
+ when 143
291
+ hex = 'afaf5f'
292
+ when 144
293
+ hex = 'afaf87'
294
+ when 145
295
+ hex = 'afafaf'
296
+ when 146
297
+ hex = 'afafd7'
298
+ when 147
299
+ hex = 'afafff'
300
+ when 148
301
+ hex = 'afd700'
302
+ when 149
303
+ hex = 'afd75f'
304
+ when 150
305
+ hex = 'afd787'
306
+ when 151
307
+ hex = 'afd7af'
308
+ when 152
309
+ hex = 'afd7d7'
310
+ when 153
311
+ hex = 'afd7ff'
312
+ when 154
313
+ hex = 'afff00'
314
+ when 155
315
+ hex = 'afff5f'
316
+ when 156
317
+ hex = 'afff87'
318
+ when 157
319
+ hex = 'afffaf'
320
+ when 158
321
+ hex = 'afffd7'
322
+ when 159
323
+ hex = 'afffff'
324
+ when 160
325
+ hex = 'd70000'
326
+ when 161
327
+ hex = 'd7005f'
328
+ when 162
329
+ hex = 'd70087'
330
+ when 163
331
+ hex = 'd700af'
332
+ when 164
333
+ hex = 'd700d7'
334
+ when 165
335
+ hex = 'd700ff'
336
+ when 166
337
+ hex = 'd75f00'
338
+ when 167
339
+ hex = 'd75f5f'
340
+ when 168
341
+ hex = 'd75f87'
342
+ when 169
343
+ hex = 'd75faf'
344
+ when 170
345
+ hex = 'd75fd7'
346
+ when 171
347
+ hex = 'd75fff'
348
+ when 172
349
+ hex = 'd78700'
350
+ when 173
351
+ hex = 'd7875f'
352
+ when 174
353
+ hex = 'd78787'
354
+ when 175
355
+ hex = 'd787af'
356
+ when 176
357
+ hex = 'd787d7'
358
+ when 177
359
+ hex = 'd787ff'
360
+ when 178
361
+ hex = 'd7af00'
362
+ when 179
363
+ hex = 'd7af5f'
364
+ when 180
365
+ hex = 'd7af87'
366
+ when 181
367
+ hex = 'd7afaf'
368
+ when 182
369
+ hex = 'd7afd7'
370
+ when 183
371
+ hex = 'd7afff'
372
+ when 184
373
+ hex = 'd7d700'
374
+ when 185
375
+ hex = 'd7d75f'
376
+ when 186
377
+ hex = 'd7d787'
378
+ when 187
379
+ hex = 'd7d7af'
380
+ when 188
381
+ hex = 'd7d7d7'
382
+ when 189
383
+ hex = 'd7d7ff'
384
+ when 190
385
+ hex = 'd7ff00'
386
+ when 191
387
+ hex = 'd7ff5f'
388
+ when 192
389
+ hex = 'd7ff87'
390
+ when 193
391
+ hex = 'd7ffaf'
392
+ when 194
393
+ hex = 'd7ffd7'
394
+ when 195
395
+ hex = 'd7ffff'
396
+ when 196
397
+ hex = 'ff0000'
398
+ when 197
399
+ hex = 'ff005f'
400
+ when 198
401
+ hex = 'ff0087'
402
+ when 199
403
+ hex = 'ff00af'
404
+ when 200
405
+ hex = 'ff00d7'
406
+ when 201
407
+ hex = 'ff00ff'
408
+ when 202
409
+ hex = 'ff5f00'
410
+ when 203
411
+ hex = 'ff5f5f'
412
+ when 204
413
+ hex = 'ff5f87'
414
+ when 205
415
+ hex = 'ff5faf'
416
+ when 206
417
+ hex = 'ff5fd7'
418
+ when 207
419
+ hex = 'ff5fff'
420
+ when 208
421
+ hex = 'ff8700'
422
+ when 209
423
+ hex = 'ff875f'
424
+ when 210
425
+ hex = 'ff8787'
426
+ when 211
427
+ hex = 'ff87af'
428
+ when 212
429
+ hex = 'ff87d7'
430
+ when 213
431
+ hex = 'ff87ff'
432
+ when 214
433
+ hex = 'ffaf00'
434
+ when 215
435
+ hex = 'ffaf5f'
436
+ when 216
437
+ hex = 'ffaf87'
438
+ when 217
439
+ hex = 'ffafaf'
440
+ when 218
441
+ hex = 'ffafd7'
442
+ when 219
443
+ hex = 'ffafff'
444
+ when 220
445
+ hex = 'ffd700'
446
+ when 221
447
+ hex = 'ffd75f'
448
+ when 222
449
+ hex = 'ffd787'
450
+ when 223
451
+ hex = 'ffd7af'
452
+ when 224
453
+ hex = 'ffd7d7'
454
+ when 225
455
+ hex = 'ffd7ff'
456
+ when 226
457
+ hex = 'ffff00'
458
+ when 227
459
+ hex = 'ffff5f'
460
+ when 228
461
+ hex = 'ffff87'
462
+ when 229
463
+ hex = 'ffffaf'
464
+ when 230
465
+ hex = 'ffffd7'
466
+ when 231
467
+ hex = 'ffffff'
468
+ when 232
469
+ hex = '080808'
470
+ when 233
471
+ hex = '121212'
472
+ when 234
473
+ hex = '1c1c1c'
474
+ when 235
475
+ hex = '262626'
476
+ when 236
477
+ hex = '303030'
478
+ when 237
479
+ hex = '3a3a3a'
480
+ when 238
481
+ hex = '444444'
482
+ when 239
483
+ hex = '4e4e4e'
484
+ when 240
485
+ hex = '585858'
486
+ when 241
487
+ hex = '626262'
488
+ when 242
489
+ hex = '6c6c6c'
490
+ when 243
491
+ hex = '767676'
492
+ when 244
493
+ hex = '808080'
494
+ when 245
495
+ hex = '8a8a8a'
496
+ when 246
497
+ hex = '949494'
498
+ when 247
499
+ hex = '9e9e9e'
500
+ when 248
501
+ hex = 'a8a8a8'
502
+ when 249
503
+ hex = 'b2b2b2'
504
+ when 250
505
+ hex = 'bcbcbc'
506
+ when 251
507
+ hex = 'c6c6c6'
508
+ when 252
509
+ hex = 'd0d0d0'
510
+ when 253
511
+ hex = 'dadada'
512
+ when 254
513
+ hex = 'e4e4e4'
514
+ when 255
515
+ hex = 'eeeeee'
516
+ end
517
+ '#' + hex
518
+ end
519
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hex256
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ellen Wondra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: ellenfromillinois@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/hex256.rb
20
+ homepage: http://rubygems.org/gems/hex256
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: 'just has a method to take an ANSI 256 # and spit out a hex'
44
+ test_files: []