X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/16b530ef1bda793f687168797b982d2c504efc81..b44d61378ef1395d5003610a7904a6c2351243a5:/termcol.inc.pl
diff --git a/termcol.inc.pl b/termcol.inc.pl
index 168894f..88c1245 100644
--- a/termcol.inc.pl
+++ b/termcol.inc.pl
@@ -1,8 +1,19 @@
-use strict;
-use 5.010;
-use Shiar_Sheet::Colour '1.02';
+use 5.014;
+use utf8;
+use Shiar_Sheet::Colour 1.05;
+{
+ default => [qw( ansi ansi88 ansi256 )],
+ more => [qw( ansi mirc pastel slutty solarized ansi88 ansi256 )],
+ ansi => [qw( cga putty xterm tango app html cgarne )],
+ legacy => [qw( c64 msx mac2 risc arnegame db16 cpc cpcboy shiar32 ppu 2c03 shovel 64 )],
+
+ xcolors => sub {
+ my $pals = do 'data/termcol-xcolor.inc.pl' or die $! || $@;
+ $_[0]->{$_} = $pals->{$_} for keys %{$pals};
+ return 'xcolor';
+ },
+
html => {
title => 'HTML keywords (inherited by CSSâ¥2.1 and SVG), mostly identical to X11',
href => 'http://www.w3.org/TR/css3-color/#html4',
@@ -12,6 +23,7 @@ use Shiar_Sheet::Colour '1.02';
808080:gray FF0000:red 00FF00:lime FFFF00:yellow
0000FF:blue FF00FF:fuchsia 00FFFF:aqua FFFFFF:white
)],
+ parent => 'cga',
},
cga => {
# linux console, kde?
@@ -20,6 +32,7 @@ use Shiar_Sheet::Colour '1.02';
555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF
)],
# reset bold dim italic underline blink fastblink reverse hidden
+ hueorder => [ 1,3,2,6,4,5, 0,7 , 9,11,10,14,12,13, 8,15 ],
},
xterm => {
# rxvt except for blues
@@ -27,6 +40,7 @@ use Shiar_Sheet::Colour '1.02';
000000 CC0000 00CC00 CCCC00 4682B4 CC00CC 00CCCC E5E5E5
4C4C4C FF0000 00FF00 FFFF00 1E90FF FF00FF 00FFFF FFFFFF
)],
+ parent => 'cga',
},
tango => {
# default Gnome theme
@@ -34,6 +48,7 @@ use Shiar_Sheet::Colour '1.02';
2E3436 CC0000 4E9A06 C4A000 3465A4 75507B 06989A D3D7CF
555753 EF2929 8AE234 FCE94F 729FCF AD7FA8 34E2E2 EEEEEC
)],
+ parent => 'cga',
},
xkcd => {
title => 'human averages in xkcd survey results',
@@ -44,6 +59,7 @@ use Shiar_Sheet::Colour '1.02';
929591:grey e50000:red aaff32:lime ffff14:yellow
0343df:blue ed0dd9:fuchsia 00ffff:cyan ffffff:white
)],
+ parent => 'cga',
},
android => {
href => 'http://developer.android.com/guide/practices/ui_guidelines/icon_design.html',
@@ -62,21 +78,16 @@ use Shiar_Sheet::Colour '1.02';
000000 990B00 35A600 999900 0000B3 B304B2 31A6B3 BFBFBF
666666 E51600 48D901 E5E600 0100FF E607E5 48E6E6 E6E5E6
)],
+ parent => 'cga',
},
- iterm => {
- name => 'iTerm',
- title => 'iTerm v2.2.1',
- list => [qw(
- 000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB
- 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF
- )],
- },
+ iterm => ['putty'], # identical in v2.2.1
pastel => {
name => 'iTerm Pastel',
list => [qw(
4F4F4F FF6C60 A8FF60 FFFFB6 96CBFE FF73FD C6C5FE EEEEEE
7C7C7C FFB6B0 CEFFAC FFFFCC B5DCFF FF9CFE DFDFFE FFFFFF
)],
+ parent => 'cga',
},
putty => {
name => 'PuTTY',
@@ -84,6 +95,7 @@ use Shiar_Sheet::Colour '1.02';
000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB
555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF
)],
+ parent => 'cga',
},
slutty => {
name => 'SluTTY',
@@ -93,6 +105,7 @@ use Shiar_Sheet::Colour '1.02';
000000 9C1D1D 6C9446 AC9A47 335786 8F6496 486768 E0DCDC
2F2F2F CD5757 8FC35B D1C45E 5C81A9 BC95B7 76CBCB EEEEEC
)],
+ parent => 'cga',
},
mirc => {
name => 'mIRC',
@@ -102,6 +115,7 @@ use Shiar_Sheet::Colour '1.02';
FFFF00 00FC00 009393 00FFFF 0000FC FF00FF 7F7F7F D2D2D2
)],
ansiorder => [ 1,5,3,7,2,6,10,15 , 14,4,9,8,12,13,11,0 ],
+ hueorder => [ 5,7,3,10,2,6, 1,15 , 4,8,9,11,12,13, 14,0 ],
},
mac2 => {
name => 'MacII',
@@ -110,6 +124,7 @@ use Shiar_Sheet::Colour '1.02';
1FB714 006412 562C05 90713A C0C0C0 808080 404040 000000
)],
ansiorder => [ 15,3,9,11,6,5,7,12 , 14,2,8,1,10,4,13,0 ],
+ hueorder => [ 3,2,1,8,7,6,5,4 , 10,11,9 , 15,14,13,12,0 ],
},
risc => {
name => 'RISC', # v2/3
@@ -118,6 +133,7 @@ use Shiar_Sheet::Colour '1.02';
004499 EEEE00 00CC00 DD0000 EEEEBB 558800 FFBB00 00BBFF
)],
ansiorder => [ 7,5,13,14,4,3,2,1 , 6,11,10,9,8,12,15,0 ],
+ hueorder => [ 11,14,9,12,13,10,15,8 , reverse 0..7 ],
},
c64 => {
name => 'C=64', # commodore 64/128
@@ -136,21 +152,23 @@ use Shiar_Sheet::Colour '1.02';
}
# convert to rgb
- $y *= 255 / 32;
- $_ = $_ * 127.5 + 128 for $u, $v;
+ $y /= 32;
+ $_ /= 2 for $u, $v;
Shiar_Sheet::Colour->newyuv($y, $u, $v)->rgb48;
} qw(
0 32 10+5 20-5 12+2 16-2 8+0 24-0
12+6 8+7 16+5 10 15 24-2 15+0 20
)],
ansiorder => [ 0,2,5,9,6,4,3,15 , 11,10,13,7,14,8,12,1 ],
+ hueorder => [ 2,8,7,5,3,6,4,9 , 10,13,14,0,11,12,15,1 ],
},
+
+ msx => [qw( msx1 msx2 arnejmp )],
msx1 => {
name => 'MSX',
list => [ map {
my ($y, @c) = split /;/;
- $y *= 255;
- $_ = ($_ - .47) / .53 * 127.5 + 128 for @c;
+ $_ = ($_ - .47) / .53 / 2 for @c;
Shiar_Sheet::Colour->newyuv($y, @c)->rgb48;
} qw(
0.00;0.47;0.47 0.00;0.47;0.47 0.53;0.20;0.07 0.67;0.27;0.17
@@ -159,6 +177,7 @@ use Shiar_Sheet::Colour '1.02';
0.47;0.23;0.13 0.53;0.67;0.73 0.80;0.47;0.47 1.00;0.47;0.47
)],
ansiorder => [ 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ],
+ hueorder => [ 8,10,2,12,4,6, 1,0 , 9,11,3,7,5,13, 14,15 ],
},
msx2 => {
name => 'MSX2',
@@ -179,18 +198,62 @@ use Shiar_Sheet::Colour '1.02';
)],
parent => 'msx1',
},
+
arnegame => {
href => 'http://androidarts.com/palette/16pal.htm',
title => 'Generic 16 color game palette v20 by Arne Niklas Jansson',
name => 'Arne',
list => [qw(
- 000000::void 9D9D9D::ash FFFFFF::blind BE2633::bloodred
- E06F8B::pigmeat 493C2B::oldpoop A46422::newpoop EB8931::blaze
- F7E26B::zornskin 2F484E::shade 44891A::leaf A3CE27::slime
- 1B2632::night 005784::sea 31A2F2::sky B2DCEF::cloud
+ 000000:void 9D9D9D:ash FFFFFF:blind BE2633:bloodred
+ E06F8B:pigmeat 493C2B:oldpoop A46422:newpoop EB8931:blaze
+ F7E26B:zornskin 2F484E:shade 44891A:leaf A3CE27:slime
+ 1B2632:night 005784:sea 31A2F2:sky B2DCEF:cloud
)],
- order => [ 0,5,9,12 , 3,6,10,13,1 , 4,7,8,11,14,15,2 ], # by brightness
+ hueorder => [ 3,7,8,11,10,9,13,14 , 4,6,5,15,12,0,1,2 ],
ansiorder => [ 0,3,10,6,13,12,9,1 , 5,7,11,8,14,4,15,2 ],
+ lumorder => [ 0,5,9,12 , 3,6,10,13,1 , 4,7,8,11,14,15,2 ], # by brightness
+ },
+ cgarne => {
+ href => 'http://androidarts.com/palette/16pal.htm',
+ title => "version E",
+ name => 'CGArne',
+ list => [qw(
+ 000000 8A3622 0C7E45 AA5C3D 2234D1 5C2E78 44AACC B5B5B5
+ 5E606E EB8A60 6CD947 FFD93F 4C81FB E23D69 7BE2F9 FFFFFF
+ )],
+ parent => 'cga',
+ },
+ db16 => {
+ href => 'http://pixeljoint.com/forum/forum_posts.asp?TID=12795',
+ title => "DawnBringer's 16 color palette v1.0",
+ name => 'DawnBringer16',
+ list => [qw(
+ 140C1C 442434 30346D 4E4A4E 854C30 346524 D04648 757161
+ 597DCE D27D2C 8595A1 6DAA2C D2AA99 6DC2CA DAD45E DEEED6
+ )],
+ ansiorder => [ 0,1,5,4,2,12,10,7 , 3,6,11,14,8,9,13,15 ],
+ hueorder => [ 6,9,14,11,13,8,2,1 , 12,4,7,5,15,10,3,0 ],
+ },
+ db32 => {
+ href => 'http://pixeljoint.com/forum/forum_posts.asp?TID=16247',
+ title => "DawnBringer's 32 color palette v1.0",
+ name => 'DawnBringer32',
+ list => [qw(
+ 000000 222034 45283C 663931 8F563B DF7126 D9A066 EEC39A
+ FBF236 99E550 6ABE30 37946E 4B692F 524B24 323C39 3F3F74
+ 306082 5B6EE1 639BFF 5FCDE4 CBDBFC FFFFFF 9BADB7 847E87
+ 696A6A 595652 76428A AC3232 D95763 D77BBA 8F974A 8A6F30
+ )],
+ },
+ solarized => {
+ href => 'http://ethanschoonover.com/solarized',
+ list => [qw(
+ 002b36:base03 073642:base02 586e75:base01 657b83:base00
+ 839496:base0 93a1a1:base1 eee8d5:base2 fdf6e3:base3
+ b58900:yellow cb4b16:orange dc322f:red d33682:magenta
+ 6c71c4:violet 268bd2:blue 2aa198:cyan 859900:green
+ )],
+ ansiorder => [ 1,10,15,8,13,11,14,6 , 0,9,2,3,4,12,5,7 ],
},
cpc => {
@@ -212,16 +275,136 @@ use Shiar_Sheet::Colour '1.02';
map { map { hex } /(..)/g } [qw(
000000 1B1B76 3636D8 761F28 623870 953EA7 CC3636 CE4B7A E3669A
1B761B 197F96 1986F2 8C6E1A 8E8E8E 9C9EE7 E48E2A EAA597 FE80FE
- 8DD836 B8D1B5 97E9D1 54BF47 37C79F 35CFE4 EDD446 EBE4A4 FFFFFF
+ 54BF47 37C79F 35CFE4 8DD836 B8D1B5 97E9D1 EDD446 EBE4A4 FFFFFF
)]->[$index]
},
- [ # gameboy ramp
- map { [ 27 + (state $index)++, map { hex } /(..)/g ] }
- qw( F2EFE7 BAC375 859550 485D48 293941 )
- ],
+ ],
+ table => [
+ # gameboy ramp
+ [qw( 293941:31 : F2EFE7:27 )],
+ [qw( 485D48:30 859550:29 BAC375:28 )],
+ ],
+ parent => 'cpc',
+ },
+ shiar32 => {
+ name => 'Shiar32',
+ table => [
+ [qw( 761F28:2A CC2222:3A CC8B7B:4A )],
+ [qw( 4C3C2B:1B CB4B16:3B EB8931:5B )],
+ [qw( 5E581A:2C B58900:3C C0C070:4C )],
+ [qw( 0 859900:3D 0 )],
+ [qw( 1B661B:2E 4E9A06:3E 8BBB7B:4E )],
+ [qw( 0 37A76F:3F 0 )],
+ [qw( 2F484E:1G 06989A:3G 31E2C2:5G )],
+ [qw( 0 0088CC:3H 0 )],
+ [qw( 00337C:2I 3465A4:3I 6899AA:4I )],
+ [qw( 0 6C71C4:3J 0 )],
+ [qw( 362747:1K 75507B:3K F06FCB:5K )],
+ [qw( 0 D33662:3L 0 )],
+ [qw( 000000:0 686868:2 CCCCCC:4 )],
+ [qw( 444444:1 B0B0B0:3 FFFFFF:5 )],
],
parent => 'cpc',
},
+
+ ppu => {
+ name => 'PPU (Famicom/NES)',
+ table => [
+ [qw( 717171:00 BABABA:10 FFFFFF:20 FFFFFF:30 )],
+ [qw( 012FB3:01 235CFF:11 5380FF:21 ACC1FF:31 )],
+ [qw( 2B17C2:02 5139FF:12 7562FF:22 BAB1FF:32 )],
+ [qw( 5705AA:03 932AFF:13 AC5AFF:23 D7B1FF:33 )],
+ [qw( 780071:04 C222BA:14 FE69F6:24 FEC0FB:34 )],
+ [qw( 860627:05 D52C57:15 FE6A90:25 FEBECF:35 )],
+ [qw( 7C1800:06 C84300:16 FE853F:26 FECBAD:36 )],
+ [qw( 5F3100:07 A16400:17 F2B403:27 FEE59D:37 )],
+ [qw( 344900:08 698400:18 B9D500:28 E9F596:38 )],
+ [qw( 095B00:09 2F9B00:19 7FEC0F:29 D1FFA3:39 )],
+ [qw( 006100:0A 04A40D:1A 52F55B:2A BCFFC0:3A )],
+ [qw( 005A39:0B 009B6F:1B 40EBBF:2B B7FEEC:3B )],
+ [qw( 004881:0C 0083CE:1C 43BBFF:2C AEE1FF:3C )],
+ [qw( 000000:0D 0C0C0C:1D 5B5B5B:2D C3C3C3:3D )],
+ ],
+ hueorder => [6..12, 1..5, 13, 0],
+ },
+ '2c03' => {
+ name => '2C03â5 PPU (PlayChoice/Famicom)',
+ table => [
+ do {
+ my @rgb = qw(
+ 333 555 777 777
+ 014 036 357 567
+ 006 027 447 657
+ 326 407 637 757
+ 403 507 707 747
+ 503 704 737 755
+ 510 700 740 764
+ 420 630 750 770
+ 320 430 660 773
+ 120 140 360 572
+ 031 040 070 473
+ 040 053 276 276
+ 022 044 077 467
+ 111 222 444 666
+ );
+ my %dup;
+ map { [
+ map { [ $dup{$_}++ ? "$_" : $_, map { $_ * 255 / 7 } split // ] }
+ map { $rgb[$_] }
+ $_*4 .. $_*4+3
+ ] } 0..13
+ }
+ ],
+ parent => 'ppu',
+ },
+ neslike => {
+ name => '0xDB NESLike',
+ table => [
+ [qw( 3F3F3F:00 7F7F7F:10 F9F9F9:20 FFFFFF:30 )],
+ [qw( 2B34AD:01 6B74ED:11 ABB4FF:21 EAF3FF:31 )],
+ [qw( 591DAB:02 995DEB:12 D99CFF:22 FFDCFF:32 )],
+ [qw( 810F8C:03 C04FCC:13 FF8EFF:23 FFCEFF:33 )],
+ [qw( 960E59:04 D64E98:14 FF8DD8:24 FFCDFF:34 )],
+ [qw( 951A1E:05 D45A5E:15 FF9A9E:25 FFD9DD:35 )],
+ [qw( 7C3000:06 BC702C:16 FCB06C:26 FFEFAC:36 )],
+ [qw( 534A00:07 938A11:17 D3CA51:27 FFFF90:37 )],
+ [qw( 256200:08 65A113:18 A5E153:28 E4FF92:38 )],
+ [qw( 096C00:09 49AC25:19 89EC65:29 C9FFA4:39 )],
+ [qw( 007213:0A 2DB153:1A 6CF193:2A ACFFD2:3A )],
+ [qw( 006A4D:0B 26AA8D:1B 66E9CD:2B A6FFFF:3B )],
+ [qw( 005683:0C 3896C3:1C 77D6FF:2C B7FFFF:3C )],
+ [qw( 000000:0D 000000:1D 333333:2D 8C8C8C:3D )],
+ ],
+ parent => 'ppu',
+ hueorder => [6..12, 1..5, 13, 0],
+ },
+ shovel => {
+ name => 'Shovel Knight PPU',
+ table => [
+ [qw( 7C7C7C:00 BCBCBC:10 F8F8F8:20 FCFCFC:30 )],
+ [qw( 0000FC:01 0078F8:11 3CBCFC:21 A4E4FC:31 )],
+ [qw( 0000BC:02 0058F8:12 6888FC:22 B8B8F8:32 )],
+ [qw( 4428BC:03 6844FC:13 9878F8:23 D8B8F8:33 )],
+ [qw( 940084:04 D800CC:14 F878F8:24 F8B8F8:34 )],
+ [qw( A80020:05 E40058:15 F85898:25 F8A4C0:35 )],
+ [qw( A81000:06 F83800:16 F87858:26 F0D0B0:36 )],
+ [qw( 881400:07 E45C10:17 FCA044:27 FCE0A8:37 )],
+ [qw( 503000:08 AC7C00:18 F8B800:28 F8D878:38 )],
+ [qw( 007800:09 00B800:19 B8F818:29 D8F878:39 )],
+ [qw( 006800:0A 00A800:1A 58D854:2A B8F8B8:3A )],
+ [qw( 005800:0B 00A844:1B 58F898:2B B8F8D8:3B )],
+ [qw( 004058:0C 008888:1C 00E8D8:2C 00FCFC:3C )],
+ [qw( 000000:0D 080808:1D 787878:2D D8D8D8:3D )],
+ [qw( 22123B:0S 360900:1S 824E00:2S 9E9E5C:3S )],
+ ],
+ parent => 'ppu',
+ hueorder => [6..12, 1..5, 13, 0, 14],
+ },
+
+ 64 => {
+ name => '6-bit (Sega Master System, EGA, FAP80)',
+ rgbmap => [4],
+ },
ansi88 => {
name => 'rxvt 88 colour extension',
rgbmap => [
@@ -234,7 +417,6 @@ use Shiar_Sheet::Colour '1.02';
},
ansi256 => {
name => 'xterm 256 colour extension',
- href => 'http://web.archive.org/web/20130125000058/http://www.frexx.de/xterm-256-notes/',
# \033[38;5;${FG}m
rgbmap => [
6 => sub {