0a7114008293c5054938fade25e823103c83f8f2
[sheet.git] / termcol.inc.pl
1 use strict;
2 use Shiar_Sheet::Colour '1.02';
3
4 my @msxorder = ( 0,6,2,10,4,13,7,14 , 1,8,3,11,5,9,12,15 );
5
6 +{
7         html => {
8                 title => 'HTML keywords (inherited by CSS≥2.1 and SVG), mostly identical to X11',
9                 href => 'http://www.w3.org/TR/css3-color/#html4',
10                 list => [qw(
11                         000000:black 800000:maroon  008000:green 808000:olive
12                         000080:navy  800080:purple  008080:cyan  C0C0C0:silver
13                         808080:gray  FF0000:red     00FF00:lime  FFFF00:yellow
14                         0000FF:blue  FF00FF:fuchsia 00FFFF:aqua  FFFFFF:white
15                 )],
16         },
17         cga => {
18                 # linux console, kde?
19                 list => [qw(
20                         000000 AA0000 00AA00 AA5500 0000AA AA00AA 00AAAA AAAAAA
21                         555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF
22                 )],
23                 # reset bold dim italic underline blink fastblink reverse hidden
24         },
25         xterm => {
26                 # rxvt except for blues
27                 list => [qw(
28                         000000 CC0000 00CC00 CCCC00 4682B4 CC00CC 00CCCC E5E5E5
29                         4C4C4C FF0000 00FF00 FFFF00 1E90FF FF00FF 00FFFF FFFFFF
30                 )],
31         },
32         tango => {
33                 # default Gnome theme
34                 list => [qw(
35                         2E3436 CC0000 4E9A06 C4A000 3465A4 75507B 06989A D3D7CF
36                         555753 EF2929 8AE234 FCE94F 729FCF AD7FA8 34E2E2 EEEEEC
37                 )],
38         },
39         xkcd => {
40                 title => 'human averages in xkcd survey results',
41                 href => 'http://blog.xkcd.com/2010/05/03/color-survey-results/',
42                 list => [qw(
43                         000000:black 650021:maroon  15b01a:green 6e750e:olive
44                         01153e:navy  7e1e9c:purple  029386:teal  c5c9c7:silver
45                         929591:grey  e50000:red     aaff32:lime  ffff14:yellow
46                         0343df:blue  ed0dd9:fuchsia 00ffff:cyan  ffffff:white
47                 )],
48         },
49         android => {
50                 href => 'http://developer.android.com/guide/practices/ui_guidelines/icon_design.html',
51                 title => 'recommended colour palette for Android icons',
52                 list => [qw(
53                         FFFFFF:white   BFBFBF:light   808080:medium  404040:dark
54                         000000:black   6699FF:blue1   3366CC:blue2   003399:blue3
55                         99CC33:green1  00CC00:green2  669933:green3  FFCC00:orange1
56                         FF9900:orange2 FF6600:orange3 CC0000:red
57                 )],
58         },
59         app => {
60                 name => 'Term.app',
61                 list => [qw(
62                         000000 C23621 25BC24 ADAD27 492EE1 D338D3 33BBC8 CBCCCD
63                         818383 FC391F 31E722 EAEC23 5833FF F935F8 14F0F0 E9EBEB
64                 )],
65         },
66         putty => {
67                 name => 'PuTTY',
68                 list => [qw(
69                         000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB
70                         555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF
71                 )],
72         },
73         slutty => {
74                 name => 'SluTTY',
75                 href => 'http://www.npjh.com/slutty.html',
76                 title => 'PuTTY fork with light colour scheme',
77                 list => [qw(
78                         000000 9C1D1D 6C9446 AC9A47 335786 8F6496 486768 E0DCDC
79                         2F2F2F CD5757 8FC35B D1C45E 5C81A9 BC95B7 76CBCB EEEEEC
80                 )],
81         },
82         mirc => {
83                 name => 'mIRC',
84                 href => 'http://www.mirc.com/colors.html',
85                 list => [qw(
86                         FFFFFF 000000 00007F 009300 FF0000 7F0000 9C009C FC7F00
87                         FFFF00 00FC00 009393 00FFFF 0000FC FF00FF 7F7F7F D2D2D2
88                 )],
89                 ansiorder => [ 1,5,3,7,2,6,10,15 , 14,4,9,8,12,13,11,0  ],
90         },
91         mac2 => {
92                 name => 'MacII',
93                 list => [qw(
94                         FFFFFF FBF305 FF6403 DD0907 F20884 4700A5 0000D3 02ABEA
95                         1FB714 006412 562C05 90713A C0C0C0 808080 404040 000000
96                 )],
97                 ansiorder => [ 15,3,9,11,6,5,7,12 , 14,2,8,1,13,4,10,0 ],
98         },
99         risc => {
100                 name => 'RISC',  # v2/3
101                 list => [qw(
102                         FFFFFF DDDDDD BBBBBB 999999 777777 555555 333333 000000
103                         004499 EEEE00 00CC00 DD0000 EEEEBB 558800 FFBB00 00BBFF
104                 )],
105                 ansiorder => [ 7,11,13,14,8,12,15,1, 6,5,10,9,4,3,2,0 ],
106         },
107         c64 => {
108                 name => 'C=64',  # commodore 64/128
109                 list => [ map {
110                         # 5-bit luma ± 2-bit colour angle
111                         my ($y, $neg, $hue) = split /(-)|\+/;
112
113                         # convert to yuv
114                         my ($u, $v) = (0, 0);
115                         if (defined $hue) {
116                                 my $RAD = 3.14159;
117                                 $hue *= $RAD / 8;
118                                 $hue += $RAD if $neg;
119                                 $u = cos $hue;
120                                 $v = sin $hue;
121                         }
122
123                         # convert to rgb
124                         $y *= 255 / 32;
125                         $_ = $_ * 127.5 + 128 for $u, $v;
126                         Shiar_Sheet::Colour->newyuv($y, $u, $v)->rgb48;
127                 } qw(
128                         0    32  10+5 20-5 12+2 16-2 8+0  24-0
129                         12+6 8+7 16+5 10   15   24-2 15+0 20
130                 )],
131                 ansiorder => [ 0,2,5,9,6,4,3,15 , 11,10,13,7,14,8,12,1 ],
132         },
133         msx1 => {
134                 name => 'MSX',
135                 list => [ map {
136                         my ($y, @c) = split /;/;
137                         $y *= 255;
138                         $_ = ($_ - .47) / .53 * 127.5 + 128 for @c;
139                         Shiar_Sheet::Colour->newyuv($y, @c)->rgb48;
140                 } qw(
141                         0.00;0.47;0.47 0.00;0.47;0.47 0.53;0.20;0.07 0.67;0.27;0.17
142                         0.40;1.00;0.40 0.53;0.93;0.43 0.47;0.30;0.83 0.73;0.70;0.00
143                         0.53;0.27;0.93 0.67;0.27;0.93 0.73;0.07;0.57 0.80;0.17;0.57
144                         0.47;0.23;0.13 0.53;0.67;0.73 0.80;0.47;0.47 1.00;0.47;0.47
145                 )],
146                 ansiorder => \@msxorder,
147         },
148         msx2 => {
149                 name => 'MSX2',
150                 list => [
151                         map { s{([0-7])}{sprintf '%02X', $1 / 7 * 255}egr } qw(
152                         000 000 161 373 117 237 511 267
153                         711 733 661 663 141 625 555 777
154                 )],
155                 ansiorder => \@msxorder,
156         },
157         arnejmp => {
158                 href => 'http://androidarts.com/palette/16pal.htm',
159                 title => "Arne's Japanese Machine Palette v3 (MSX)",
160                 name => 'A:JMP',
161                 list => [qw(
162                         000000 191028 46AF45 A1D685 453E78 7664FE 833129 9EC2E8
163                         DC534B E18D79 D6B97B E9D8A1 216C4B D365C8 AFAAB9 F5F4EB
164                 )],
165                 ansiorder => \@msxorder,
166         },
167         arnegame => {
168                 href => 'http://androidarts.com/palette/16pal.htm',
169                 title => 'Generic 16 color game palette v20 by Arne Niklas Jansson',
170                 name => 'Arne',
171                 list => [qw(
172                         000000::void     9D9D9D::ash     FFFFFF::blind   BE2633::bloodred
173                         E06F8B::pigmeat  493C2B::oldpoop A46422::newpoop EB8931::blaze
174                         F7E26B::zornskin 2F484E::shade   44891A::leaf    A3CE27::slime
175                         1B2632::night    005784::sea     31A2F2::sky     B2DCEF::cloud
176                 )],
177                 order => [ 0,5,9,12 , 3,6,10,13,1 , 4,7,8,11,14,15,2 ], # by brightness
178                 ansiorder => [ 0,3,10,6,13,12,9,1 , 5,7,11,8,14,4,15,2 ],
179         },
180
181         cpc => {
182                 name => 'Amstrad CPC',
183                 rgbmap => [
184                         3 => sub {
185                                 $_[2] + 3 * ($_[0] + 3 * $_[1]),
186                                 map { $_ && $_ * 127 + 1 } @_
187                         },
188                 ],
189         },
190         ansi88 => {
191                 name => 'rxvt 88 colour extension',
192                 rgbmap => [
193                         4 => sub {
194                                 $_[2] + 4 * ($_[1] + 4 * $_[0]) + 16,
195                                 map { (0, 139, 205, 255)[$_] } @_
196                         },
197                         [ map { ($_ + 2 + ($_>0)) * 255/11 } 0 .. 7 ],
198                 ],
199         },
200         ansi256 => {
201                 name => 'xterm 256 colour extension',
202                 href => 'http://web.archive.org/web/20130125000058/http://www.frexx.de/xterm-256-notes/',
203                 # \033[38;5;${FG}m
204                 rgbmap => [
205                         6 => sub {
206                                 $_[2] + 6 * ($_[1] + 6 * $_[0]) + 16,
207                                 map { $_ && $_*40 + 55 } @_
208                         },
209                         [ map { $_ * 10 + 8 } 0 .. 23 ],
210                 ],
211         },
212         512 => {
213                 name => '9-bit RGB map',
214                 # atari st, msx2, sega genesis/nomad, turbografx16
215                 rgbmap => [8],
216         },
217         '4k' => {
218                 name => '12-bit RGB map',
219                 # amiga, apple IIgs, game gear, neo geo, lynx, cpc+, nextstation
220                 rgbmap => [
221                         12 => sub {
222                                 join('', map { sprintf '%X', $_ } @_),
223                                 map { int $_ * 255 / 11 } @_
224                         },
225                 ],
226         },
227 }