X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/ddda836ae83e6ffc5fa9f0b60afc03a3b99ae9e7..54ea9d7c62215933a9b77f16b28717ea65a178ad:/termcol.plp diff --git a/termcol.plp b/termcol.plp index 24f9550..73bf0d2 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,147 +1,210 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; -use List::Util 'min'; - -our $VERSION = 'v1.0'; +<(common.inc.plp)><: + +Html({ + title => 'terminal colour cheat sheet', + version => '1.0', + description => [ + "Index of all terminal/console colour codes,", + "with an example result of various environments.", + ], + keywords => [qw' + color code terminal console escape table xterm rxvt + '], + data => ['termcol.inc.pl'], + stylesheet => [qw'light dark'], +}); + +my $imgfile = $get{img} // exists $get{img} && 'indi.png'; + +my @termlist; +push @termlist, split /\W+/, $ENV{PATH_INFO} || 'default'; + +my %termgroup = ( + default => [qw( ansi xkcd ansi88 )], + more => [qw( ansi legacy ansi256 )], + msx => [qw( msx1 msx2 arnejmp )], + ansi => [qw( cga xterm tango app html )], + legacy => [qw( c64 msx2 mac2 risc arnegame cpc )], +); +@{$_} = map { $termgroup{$_} ? @{ $termgroup{$_} } : $_ } @{$_} + for values %termgroup, \@termlist; -$header{content_type} = 'text/html; charset=utf-8'; +:> +

Terminal colours

-:> - +

+ANSI (VT100, ISO-6429) 16-colour text palette +as implemented by various systems and programs. +<: +print + "@termlist" ne "@{ $termgroup{default} }" ? 'Additional palettes are included as specified.' : + 'Also see 8-bit legacy hardware palettes.'; +:> +

- -terminal colour cheat sheet - - - +
+<: +use 5.010; +use Shiar_Sheet::Colour '1.03'; +use List::Util qw( min max ); - -

Terminal colours

+my $palettes = do 'termcol.inc.pl'; +die "Cannot open palette data: $_\n" for $@ || $! || (); - -
-

88-colour space

+ my $out = ''; + $out .= sprintf '', scalar @{$_} for @colmap; + my $huerow = $colmap[0][0]; # first {$_} map { @{$_} } @colmap; + for my $h (grep { $huerow->[$_] } 0 .. $#{$huerow}) { + $out .= ''; + $out .= colcell(@$_) for map { $_->[$h] } map { @{$_} } @colmap; + } -
-

256-colour space

+:>

- - -