forked from gdamore/tcell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
color.go
1081 lines (1059 loc) · 29.9 KB
/
color.go
1
2
3
4
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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2020 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tcell
import (
ic "image/color"
"strconv"
)
// Color represents a color. The low numeric values are the same as used
// by ECMA-48, and beyond that XTerm. A 24-bit RGB value may be used by
// adding in the ColorIsRGB flag. For Color names we use the W3C approved
// color names.
//
// We use a 64-bit integer to allow future expansion if we want to add an
// 8-bit alpha, while still leaving us some room for extra options.
//
// Note that on various terminals colors may be approximated however, or
// not supported at all. If no suitable representation for a color is known,
// the library will simply not set any color, deferring to whatever default
// attributes the terminal uses.
type Color uint64
const (
// ColorDefault is used to leave the Color unchanged from whatever
// system or terminal default may exist. It's also the zero value.
ColorDefault Color = 0
// ColorValid is used to indicate the color value is actually
// valid (initialized). This is useful to permit the zero value
// to be treated as the default.
ColorValid Color = 1 << 32
// ColorIsRGB is used to indicate that the numeric value is not
// a known color constant, but rather an RGB value. The lower
// order 3 bytes are RGB.
ColorIsRGB Color = 1 << 33
// ColorSpecial is a flag used to indicate that the values have
// special meaning, and live outside of the color space(s).
ColorSpecial Color = 1 << 34
)
// Note that the order of these options is important -- it follows the
// definitions used by ECMA and XTerm. Hence any further named colors
// must begin at a value not less than 256.
const (
ColorBlack = ColorValid + iota
ColorMaroon
ColorGreen
ColorOlive
ColorNavy
ColorPurple
ColorTeal
ColorSilver
ColorGray
ColorRed
ColorLime
ColorYellow
ColorBlue
ColorFuchsia
ColorAqua
ColorWhite
Color16
Color17
Color18
Color19
Color20
Color21
Color22
Color23
Color24
Color25
Color26
Color27
Color28
Color29
Color30
Color31
Color32
Color33
Color34
Color35
Color36
Color37
Color38
Color39
Color40
Color41
Color42
Color43
Color44
Color45
Color46
Color47
Color48
Color49
Color50
Color51
Color52
Color53
Color54
Color55
Color56
Color57
Color58
Color59
Color60
Color61
Color62
Color63
Color64
Color65
Color66
Color67
Color68
Color69
Color70
Color71
Color72
Color73
Color74
Color75
Color76
Color77
Color78
Color79
Color80
Color81
Color82
Color83
Color84
Color85
Color86
Color87
Color88
Color89
Color90
Color91
Color92
Color93
Color94
Color95
Color96
Color97
Color98
Color99
Color100
Color101
Color102
Color103
Color104
Color105
Color106
Color107
Color108
Color109
Color110
Color111
Color112
Color113
Color114
Color115
Color116
Color117
Color118
Color119
Color120
Color121
Color122
Color123
Color124
Color125
Color126
Color127
Color128
Color129
Color130
Color131
Color132
Color133
Color134
Color135
Color136
Color137
Color138
Color139
Color140
Color141
Color142
Color143
Color144
Color145
Color146
Color147
Color148
Color149
Color150
Color151
Color152
Color153
Color154
Color155
Color156
Color157
Color158
Color159
Color160
Color161
Color162
Color163
Color164
Color165
Color166
Color167
Color168
Color169
Color170
Color171
Color172
Color173
Color174
Color175
Color176
Color177
Color178
Color179
Color180
Color181
Color182
Color183
Color184
Color185
Color186
Color187
Color188
Color189
Color190
Color191
Color192
Color193
Color194
Color195
Color196
Color197
Color198
Color199
Color200
Color201
Color202
Color203
Color204
Color205
Color206
Color207
Color208
Color209
Color210
Color211
Color212
Color213
Color214
Color215
Color216
Color217
Color218
Color219
Color220
Color221
Color222
Color223
Color224
Color225
Color226
Color227
Color228
Color229
Color230
Color231
Color232
Color233
Color234
Color235
Color236
Color237
Color238
Color239
Color240
Color241
Color242
Color243
Color244
Color245
Color246
Color247
Color248
Color249
Color250
Color251
Color252
Color253
Color254
Color255
ColorAliceBlue
ColorAntiqueWhite
ColorAquaMarine
ColorAzure
ColorBeige
ColorBisque
ColorBlanchedAlmond
ColorBlueViolet
ColorBrown
ColorBurlyWood
ColorCadetBlue
ColorChartreuse
ColorChocolate
ColorCoral
ColorCornflowerBlue
ColorCornsilk
ColorCrimson
ColorDarkBlue
ColorDarkCyan
ColorDarkGoldenrod
ColorDarkGray
ColorDarkGreen
ColorDarkKhaki
ColorDarkMagenta
ColorDarkOliveGreen
ColorDarkOrange
ColorDarkOrchid
ColorDarkRed
ColorDarkSalmon
ColorDarkSeaGreen
ColorDarkSlateBlue
ColorDarkSlateGray
ColorDarkTurquoise
ColorDarkViolet
ColorDeepPink
ColorDeepSkyBlue
ColorDimGray
ColorDodgerBlue
ColorFireBrick
ColorFloralWhite
ColorForestGreen
ColorGainsboro
ColorGhostWhite
ColorGold
ColorGoldenrod
ColorGreenYellow
ColorHoneydew
ColorHotPink
ColorIndianRed
ColorIndigo
ColorIvory
ColorKhaki
ColorLavender
ColorLavenderBlush
ColorLawnGreen
ColorLemonChiffon
ColorLightBlue
ColorLightCoral
ColorLightCyan
ColorLightGoldenrodYellow
ColorLightGray
ColorLightGreen
ColorLightPink
ColorLightSalmon
ColorLightSeaGreen
ColorLightSkyBlue
ColorLightSlateGray
ColorLightSteelBlue
ColorLightYellow
ColorLimeGreen
ColorLinen
ColorMediumAquamarine
ColorMediumBlue
ColorMediumOrchid
ColorMediumPurple
ColorMediumSeaGreen
ColorMediumSlateBlue
ColorMediumSpringGreen
ColorMediumTurquoise
ColorMediumVioletRed
ColorMidnightBlue
ColorMintCream
ColorMistyRose
ColorMoccasin
ColorNavajoWhite
ColorOldLace
ColorOliveDrab
ColorOrange
ColorOrangeRed
ColorOrchid
ColorPaleGoldenrod
ColorPaleGreen
ColorPaleTurquoise
ColorPaleVioletRed
ColorPapayaWhip
ColorPeachPuff
ColorPeru
ColorPink
ColorPlum
ColorPowderBlue
ColorRebeccaPurple
ColorRosyBrown
ColorRoyalBlue
ColorSaddleBrown
ColorSalmon
ColorSandyBrown
ColorSeaGreen
ColorSeashell
ColorSienna
ColorSkyblue
ColorSlateBlue
ColorSlateGray
ColorSnow
ColorSpringGreen
ColorSteelBlue
ColorTan
ColorThistle
ColorTomato
ColorTurquoise
ColorViolet
ColorWheat
ColorWhiteSmoke
ColorYellowGreen
)
// These are aliases for the color gray, because some of us spell
// it as grey.
const (
ColorGrey = ColorGray
ColorDimGrey = ColorDimGray
ColorDarkGrey = ColorDarkGray
ColorDarkSlateGrey = ColorDarkSlateGray
ColorLightGrey = ColorLightGray
ColorLightSlateGrey = ColorLightSlateGray
ColorSlateGrey = ColorSlateGray
)
// ColorValues maps color constants to their RGB values.
var ColorValues = map[Color]int32{
ColorBlack: 0x000000,
ColorMaroon: 0x800000,
ColorGreen: 0x008000,
ColorOlive: 0x808000,
ColorNavy: 0x000080,
ColorPurple: 0x800080,
ColorTeal: 0x008080,
ColorSilver: 0xC0C0C0,
ColorGray: 0x808080,
ColorRed: 0xFF0000,
ColorLime: 0x00FF00,
ColorYellow: 0xFFFF00,
ColorBlue: 0x0000FF,
ColorFuchsia: 0xFF00FF,
ColorAqua: 0x00FFFF,
ColorWhite: 0xFFFFFF,
Color16: 0x000000, // black
Color17: 0x00005F,
Color18: 0x000087,
Color19: 0x0000AF,
Color20: 0x0000D7,
Color21: 0x0000FF, // blue
Color22: 0x005F00,
Color23: 0x005F5F,
Color24: 0x005F87,
Color25: 0x005FAF,
Color26: 0x005FD7,
Color27: 0x005FFF,
Color28: 0x008700,
Color29: 0x00875F,
Color30: 0x008787,
Color31: 0x0087Af,
Color32: 0x0087D7,
Color33: 0x0087FF,
Color34: 0x00AF00,
Color35: 0x00AF5F,
Color36: 0x00AF87,
Color37: 0x00AFAF,
Color38: 0x00AFD7,
Color39: 0x00AFFF,
Color40: 0x00D700,
Color41: 0x00D75F,
Color42: 0x00D787,
Color43: 0x00D7AF,
Color44: 0x00D7D7,
Color45: 0x00D7FF,
Color46: 0x00FF00, // lime
Color47: 0x00FF5F,
Color48: 0x00FF87,
Color49: 0x00FFAF,
Color50: 0x00FFd7,
Color51: 0x00FFFF, // aqua
Color52: 0x5F0000,
Color53: 0x5F005F,
Color54: 0x5F0087,
Color55: 0x5F00AF,
Color56: 0x5F00D7,
Color57: 0x5F00FF,
Color58: 0x5F5F00,
Color59: 0x5F5F5F,
Color60: 0x5F5F87,
Color61: 0x5F5FAF,
Color62: 0x5F5FD7,
Color63: 0x5F5FFF,
Color64: 0x5F8700,
Color65: 0x5F875F,
Color66: 0x5F8787,
Color67: 0x5F87AF,
Color68: 0x5F87D7,
Color69: 0x5F87FF,
Color70: 0x5FAF00,
Color71: 0x5FAF5F,
Color72: 0x5FAF87,
Color73: 0x5FAFAF,
Color74: 0x5FAFD7,
Color75: 0x5FAFFF,
Color76: 0x5FD700,
Color77: 0x5FD75F,
Color78: 0x5FD787,
Color79: 0x5FD7AF,
Color80: 0x5FD7D7,
Color81: 0x5FD7FF,
Color82: 0x5FFF00,
Color83: 0x5FFF5F,
Color84: 0x5FFF87,
Color85: 0x5FFFAF,
Color86: 0x5FFFD7,
Color87: 0x5FFFFF,
Color88: 0x870000,
Color89: 0x87005F,
Color90: 0x870087,
Color91: 0x8700AF,
Color92: 0x8700D7,
Color93: 0x8700FF,
Color94: 0x875F00,
Color95: 0x875F5F,
Color96: 0x875F87,
Color97: 0x875FAF,
Color98: 0x875FD7,
Color99: 0x875FFF,
Color100: 0x878700,
Color101: 0x87875F,
Color102: 0x878787,
Color103: 0x8787AF,
Color104: 0x8787D7,
Color105: 0x8787FF,
Color106: 0x87AF00,
Color107: 0x87AF5F,
Color108: 0x87AF87,
Color109: 0x87AFAF,
Color110: 0x87AFD7,
Color111: 0x87AFFF,
Color112: 0x87D700,
Color113: 0x87D75F,
Color114: 0x87D787,
Color115: 0x87D7AF,
Color116: 0x87D7D7,
Color117: 0x87D7FF,
Color118: 0x87FF00,
Color119: 0x87FF5F,
Color120: 0x87FF87,
Color121: 0x87FFAF,
Color122: 0x87FFD7,
Color123: 0x87FFFF,
Color124: 0xAF0000,
Color125: 0xAF005F,
Color126: 0xAF0087,
Color127: 0xAF00AF,
Color128: 0xAF00D7,
Color129: 0xAF00FF,
Color130: 0xAF5F00,
Color131: 0xAF5F5F,
Color132: 0xAF5F87,
Color133: 0xAF5FAF,
Color134: 0xAF5FD7,
Color135: 0xAF5FFF,
Color136: 0xAF8700,
Color137: 0xAF875F,
Color138: 0xAF8787,
Color139: 0xAF87AF,
Color140: 0xAF87D7,
Color141: 0xAF87FF,
Color142: 0xAFAF00,
Color143: 0xAFAF5F,
Color144: 0xAFAF87,
Color145: 0xAFAFAF,
Color146: 0xAFAFD7,
Color147: 0xAFAFFF,
Color148: 0xAFD700,
Color149: 0xAFD75F,
Color150: 0xAFD787,
Color151: 0xAFD7AF,
Color152: 0xAFD7D7,
Color153: 0xAFD7FF,
Color154: 0xAFFF00,
Color155: 0xAFFF5F,
Color156: 0xAFFF87,
Color157: 0xAFFFAF,
Color158: 0xAFFFD7,
Color159: 0xAFFFFF,
Color160: 0xD70000,
Color161: 0xD7005F,
Color162: 0xD70087,
Color163: 0xD700AF,
Color164: 0xD700D7,
Color165: 0xD700FF,
Color166: 0xD75F00,
Color167: 0xD75F5F,
Color168: 0xD75F87,
Color169: 0xD75FAF,
Color170: 0xD75FD7,
Color171: 0xD75FFF,
Color172: 0xD78700,
Color173: 0xD7875F,
Color174: 0xD78787,
Color175: 0xD787AF,
Color176: 0xD787D7,
Color177: 0xD787FF,
Color178: 0xD7AF00,
Color179: 0xD7AF5F,
Color180: 0xD7AF87,
Color181: 0xD7AFAF,
Color182: 0xD7AFD7,
Color183: 0xD7AFFF,
Color184: 0xD7D700,
Color185: 0xD7D75F,
Color186: 0xD7D787,
Color187: 0xD7D7AF,
Color188: 0xD7D7D7,
Color189: 0xD7D7FF,
Color190: 0xD7FF00,
Color191: 0xD7FF5F,
Color192: 0xD7FF87,
Color193: 0xD7FFAF,
Color194: 0xD7FFD7,
Color195: 0xD7FFFF,
Color196: 0xFF0000, // red
Color197: 0xFF005F,
Color198: 0xFF0087,
Color199: 0xFF00AF,
Color200: 0xFF00D7,
Color201: 0xFF00FF, // fuchsia
Color202: 0xFF5F00,
Color203: 0xFF5F5F,
Color204: 0xFF5F87,
Color205: 0xFF5FAF,
Color206: 0xFF5FD7,
Color207: 0xFF5FFF,
Color208: 0xFF8700,
Color209: 0xFF875F,
Color210: 0xFF8787,
Color211: 0xFF87AF,
Color212: 0xFF87D7,
Color213: 0xFF87FF,
Color214: 0xFFAF00,
Color215: 0xFFAF5F,
Color216: 0xFFAF87,
Color217: 0xFFAFAF,
Color218: 0xFFAFD7,
Color219: 0xFFAFFF,
Color220: 0xFFD700,
Color221: 0xFFD75F,
Color222: 0xFFD787,
Color223: 0xFFD7AF,
Color224: 0xFFD7D7,
Color225: 0xFFD7FF,
Color226: 0xFFFF00, // yellow
Color227: 0xFFFF5F,
Color228: 0xFFFF87,
Color229: 0xFFFFAF,
Color230: 0xFFFFD7,
Color231: 0xFFFFFF, // white
Color232: 0x080808,
Color233: 0x121212,
Color234: 0x1C1C1C,
Color235: 0x262626,
Color236: 0x303030,
Color237: 0x3A3A3A,
Color238: 0x444444,
Color239: 0x4E4E4E,
Color240: 0x585858,
Color241: 0x626262,
Color242: 0x6C6C6C,
Color243: 0x767676,
Color244: 0x808080, // grey
Color245: 0x8A8A8A,
Color246: 0x949494,
Color247: 0x9E9E9E,
Color248: 0xA8A8A8,
Color249: 0xB2B2B2,
Color250: 0xBCBCBC,
Color251: 0xC6C6C6,
Color252: 0xD0D0D0,
Color253: 0xDADADA,
Color254: 0xE4E4E4,
Color255: 0xEEEEEE,
ColorAliceBlue: 0xF0F8FF,
ColorAntiqueWhite: 0xFAEBD7,
ColorAquaMarine: 0x7FFFD4,
ColorAzure: 0xF0FFFF,
ColorBeige: 0xF5F5DC,
ColorBisque: 0xFFE4C4,
ColorBlanchedAlmond: 0xFFEBCD,
ColorBlueViolet: 0x8A2BE2,
ColorBrown: 0xA52A2A,
ColorBurlyWood: 0xDEB887,
ColorCadetBlue: 0x5F9EA0,
ColorChartreuse: 0x7FFF00,
ColorChocolate: 0xD2691E,
ColorCoral: 0xFF7F50,
ColorCornflowerBlue: 0x6495ED,
ColorCornsilk: 0xFFF8DC,
ColorCrimson: 0xDC143C,
ColorDarkBlue: 0x00008B,
ColorDarkCyan: 0x008B8B,
ColorDarkGoldenrod: 0xB8860B,
ColorDarkGray: 0xA9A9A9,
ColorDarkGreen: 0x006400,
ColorDarkKhaki: 0xBDB76B,
ColorDarkMagenta: 0x8B008B,
ColorDarkOliveGreen: 0x556B2F,
ColorDarkOrange: 0xFF8C00,
ColorDarkOrchid: 0x9932CC,
ColorDarkRed: 0x8B0000,
ColorDarkSalmon: 0xE9967A,
ColorDarkSeaGreen: 0x8FBC8F,
ColorDarkSlateBlue: 0x483D8B,
ColorDarkSlateGray: 0x2F4F4F,
ColorDarkTurquoise: 0x00CED1,
ColorDarkViolet: 0x9400D3,
ColorDeepPink: 0xFF1493,
ColorDeepSkyBlue: 0x00BFFF,
ColorDimGray: 0x696969,
ColorDodgerBlue: 0x1E90FF,
ColorFireBrick: 0xB22222,
ColorFloralWhite: 0xFFFAF0,
ColorForestGreen: 0x228B22,
ColorGainsboro: 0xDCDCDC,
ColorGhostWhite: 0xF8F8FF,
ColorGold: 0xFFD700,
ColorGoldenrod: 0xDAA520,
ColorGreenYellow: 0xADFF2F,
ColorHoneydew: 0xF0FFF0,
ColorHotPink: 0xFF69B4,
ColorIndianRed: 0xCD5C5C,
ColorIndigo: 0x4B0082,
ColorIvory: 0xFFFFF0,
ColorKhaki: 0xF0E68C,
ColorLavender: 0xE6E6FA,
ColorLavenderBlush: 0xFFF0F5,
ColorLawnGreen: 0x7CFC00,
ColorLemonChiffon: 0xFFFACD,
ColorLightBlue: 0xADD8E6,
ColorLightCoral: 0xF08080,
ColorLightCyan: 0xE0FFFF,
ColorLightGoldenrodYellow: 0xFAFAD2,
ColorLightGray: 0xD3D3D3,
ColorLightGreen: 0x90EE90,
ColorLightPink: 0xFFB6C1,
ColorLightSalmon: 0xFFA07A,
ColorLightSeaGreen: 0x20B2AA,
ColorLightSkyBlue: 0x87CEFA,
ColorLightSlateGray: 0x778899,
ColorLightSteelBlue: 0xB0C4DE,
ColorLightYellow: 0xFFFFE0,
ColorLimeGreen: 0x32CD32,
ColorLinen: 0xFAF0E6,
ColorMediumAquamarine: 0x66CDAA,
ColorMediumBlue: 0x0000CD,
ColorMediumOrchid: 0xBA55D3,
ColorMediumPurple: 0x9370DB,
ColorMediumSeaGreen: 0x3CB371,
ColorMediumSlateBlue: 0x7B68EE,
ColorMediumSpringGreen: 0x00FA9A,
ColorMediumTurquoise: 0x48D1CC,
ColorMediumVioletRed: 0xC71585,
ColorMidnightBlue: 0x191970,
ColorMintCream: 0xF5FFFA,
ColorMistyRose: 0xFFE4E1,
ColorMoccasin: 0xFFE4B5,
ColorNavajoWhite: 0xFFDEAD,
ColorOldLace: 0xFDF5E6,
ColorOliveDrab: 0x6B8E23,
ColorOrange: 0xFFA500,
ColorOrangeRed: 0xFF4500,
ColorOrchid: 0xDA70D6,
ColorPaleGoldenrod: 0xEEE8AA,
ColorPaleGreen: 0x98FB98,
ColorPaleTurquoise: 0xAFEEEE,
ColorPaleVioletRed: 0xDB7093,
ColorPapayaWhip: 0xFFEFD5,
ColorPeachPuff: 0xFFDAB9,
ColorPeru: 0xCD853F,
ColorPink: 0xFFC0CB,
ColorPlum: 0xDDA0DD,
ColorPowderBlue: 0xB0E0E6,
ColorRebeccaPurple: 0x663399,
ColorRosyBrown: 0xBC8F8F,
ColorRoyalBlue: 0x4169E1,
ColorSaddleBrown: 0x8B4513,
ColorSalmon: 0xFA8072,
ColorSandyBrown: 0xF4A460,
ColorSeaGreen: 0x2E8B57,
ColorSeashell: 0xFFF5EE,
ColorSienna: 0xA0522D,
ColorSkyblue: 0x87CEEB,
ColorSlateBlue: 0x6A5ACD,
ColorSlateGray: 0x708090,
ColorSnow: 0xFFFAFA,
ColorSpringGreen: 0x00FF7F,
ColorSteelBlue: 0x4682B4,
ColorTan: 0xD2B48C,
ColorThistle: 0xD8BFD8,
ColorTomato: 0xFF6347,
ColorTurquoise: 0x40E0D0,
ColorViolet: 0xEE82EE,
ColorWheat: 0xF5DEB3,
ColorWhiteSmoke: 0xF5F5F5,
ColorYellowGreen: 0x9ACD32,
}
// Special colors.
const (
// ColorReset is used to indicate that the color should use the
// vanilla terminal colors. (Basically go back to the defaults.)
ColorReset = ColorSpecial | iota
)
// ColorNames holds the written names of colors. Useful to present a list of
// recognized named colors.
var ColorNames = map[string]Color{
"black": ColorBlack,
"maroon": ColorMaroon,
"green": ColorGreen,
"olive": ColorOlive,
"navy": ColorNavy,
"purple": ColorPurple,
"teal": ColorTeal,
"silver": ColorSilver,
"gray": ColorGray,
"red": ColorRed,
"lime": ColorLime,
"yellow": ColorYellow,
"blue": ColorBlue,
"fuchsia": ColorFuchsia,
"aqua": ColorAqua,
"white": ColorWhite,
"aliceblue": ColorAliceBlue,
"antiquewhite": ColorAntiqueWhite,
"aquamarine": ColorAquaMarine,
"azure": ColorAzure,
"beige": ColorBeige,
"bisque": ColorBisque,
"blanchedalmond": ColorBlanchedAlmond,
"blueviolet": ColorBlueViolet,
"brown": ColorBrown,
"burlywood": ColorBurlyWood,
"cadetblue": ColorCadetBlue,
"chartreuse": ColorChartreuse,
"chocolate": ColorChocolate,
"coral": ColorCoral,
"cornflowerblue": ColorCornflowerBlue,
"cornsilk": ColorCornsilk,
"crimson": ColorCrimson,
"darkblue": ColorDarkBlue,
"darkcyan": ColorDarkCyan,
"darkgoldenrod": ColorDarkGoldenrod,
"darkgray": ColorDarkGray,
"darkgreen": ColorDarkGreen,
"darkkhaki": ColorDarkKhaki,
"darkmagenta": ColorDarkMagenta,
"darkolivegreen": ColorDarkOliveGreen,
"darkorange": ColorDarkOrange,
"darkorchid": ColorDarkOrchid,
"darkred": ColorDarkRed,
"darksalmon": ColorDarkSalmon,
"darkseagreen": ColorDarkSeaGreen,
"darkslateblue": ColorDarkSlateBlue,
"darkslategray": ColorDarkSlateGray,
"darkturquoise": ColorDarkTurquoise,
"darkviolet": ColorDarkViolet,
"deeppink": ColorDeepPink,
"deepskyblue": ColorDeepSkyBlue,
"dimgray": ColorDimGray,
"dodgerblue": ColorDodgerBlue,
"firebrick": ColorFireBrick,
"floralwhite": ColorFloralWhite,
"forestgreen": ColorForestGreen,
"gainsboro": ColorGainsboro,
"ghostwhite": ColorGhostWhite,
"gold": ColorGold,
"goldenrod": ColorGoldenrod,
"greenyellow": ColorGreenYellow,
"honeydew": ColorHoneydew,
"hotpink": ColorHotPink,
"indianred": ColorIndianRed,
"indigo": ColorIndigo,
"ivory": ColorIvory,
"khaki": ColorKhaki,
"lavender": ColorLavender,
"lavenderblush": ColorLavenderBlush,
"lawngreen": ColorLawnGreen,
"lemonchiffon": ColorLemonChiffon,
"lightblue": ColorLightBlue,
"lightcoral": ColorLightCoral,
"lightcyan": ColorLightCyan,
"lightgoldenrodyellow": ColorLightGoldenrodYellow,
"lightgray": ColorLightGray,
"lightgreen": ColorLightGreen,
"lightpink": ColorLightPink,
"lightsalmon": ColorLightSalmon,
"lightseagreen": ColorLightSeaGreen,
"lightskyblue": ColorLightSkyBlue,
"lightslategray": ColorLightSlateGray,
"lightsteelblue": ColorLightSteelBlue,
"lightyellow": ColorLightYellow,
"limegreen": ColorLimeGreen,
"linen": ColorLinen,
"mediumaquamarine": ColorMediumAquamarine,
"mediumblue": ColorMediumBlue,
"mediumorchid": ColorMediumOrchid,
"mediumpurple": ColorMediumPurple,
"mediumseagreen": ColorMediumSeaGreen,
"mediumslateblue": ColorMediumSlateBlue,
"mediumspringgreen": ColorMediumSpringGreen,
"mediumturquoise": ColorMediumTurquoise,
"mediumvioletred": ColorMediumVioletRed,
"midnightblue": ColorMidnightBlue,
"mintcream": ColorMintCream,
"mistyrose": ColorMistyRose,
"moccasin": ColorMoccasin,
"navajowhite": ColorNavajoWhite,
"oldlace": ColorOldLace,
"olivedrab": ColorOliveDrab,
"orange": ColorOrange,
"orangered": ColorOrangeRed,
"orchid": ColorOrchid,
"palegoldenrod": ColorPaleGoldenrod,
"palegreen": ColorPaleGreen,
"paleturquoise": ColorPaleTurquoise,
"palevioletred": ColorPaleVioletRed,
"papayawhip": ColorPapayaWhip,
"peachpuff": ColorPeachPuff,
"peru": ColorPeru,
"pink": ColorPink,
"plum": ColorPlum,
"powderblue": ColorPowderBlue,
"rebeccapurple": ColorRebeccaPurple,
"rosybrown": ColorRosyBrown,
"royalblue": ColorRoyalBlue,
"saddlebrown": ColorSaddleBrown,
"salmon": ColorSalmon,
"sandybrown": ColorSandyBrown,
"seagreen": ColorSeaGreen,
"seashell": ColorSeashell,
"sienna": ColorSienna,
"skyblue": ColorSkyblue,
"slateblue": ColorSlateBlue,
"slategray": ColorSlateGray,
"snow": ColorSnow,
"springgreen": ColorSpringGreen,
"steelblue": ColorSteelBlue,
"tan": ColorTan,
"thistle": ColorThistle,
"tomato": ColorTomato,
"turquoise": ColorTurquoise,
"violet": ColorViolet,
"wheat": ColorWheat,
"whitesmoke": ColorWhiteSmoke,
"yellowgreen": ColorYellowGreen,
"grey": ColorGray,
"dimgrey": ColorDimGray,
"darkgrey": ColorDarkGray,
"darkslategrey": ColorDarkSlateGray,
"lightgrey": ColorLightGray,
"lightslategrey": ColorLightSlateGray,
"slategrey": ColorSlateGray,
}
// Valid indicates the color is a valid value (has been set).
func (c Color) Valid() bool {
return c&ColorValid != 0
}
// IsRGB is true if the color is an RGB specific value.
func (c Color) IsRGB() bool {