X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/0934eb163565512a7e1622f931a2f6a60b7c0872..f1ad2d8f64690870d6bb4977b04202083797d6a2:/termcol.plp diff --git a/termcol.plp b/termcol.plp index c7c74bf..8e61fe0 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,132 +1,271 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; -use List::Util 'min'; +<(common.inc.plp)><: -our $VERSION = 'v1.0'; +Html({ + title => ($Request ? 'terminal colour' : 'colour palettes') . ' cheat sheet', + version => '1.1', + description => [!$Request ? "Comparison of various colour palettes." : ( + "Index of all terminal/console colour codes,", + "with an example result of various environments.", + )], + keywords => [qw' + color colour code terminal console escape table xterm rxvt + ansi vt100 8bit 4bit cga ega vga rgb hsv game emulator display + '], + data => ['termcol.inc.pl'], + stylesheet => [qw'light dark'], +}); -$header{content_type} = 'text/html; charset=utf-8'; +my @draw = map { [$_, s/\W+\z//] } grep { $_ } split m(/), + $get{img} // exists $get{img} && 'indi.png'; -:> - +my @termlist; +push @termlist, split /\W+/, $Request || 'default'; - -terminal colour cheat sheet - - - +say "

$_

\n" for $Request ? 'Colour palettes' : 'Terminal colours'; - -

Terminal colours

+say '

'; +if ("@termlist" eq 'default') { + say 'ANSI (VT100, ISO-6429) 16-colour text palette'; + say 'as implemented by various systems and programs.'; + say 'Also see 8-bit legacy hardware palettes.'; +} +elsif ("@termlist" eq 'legacy') { + say 'Colour palettes of various 8-bit legacy systems and retro games.'; + say 'Also see ANSI console palettes.'; +} +else { + say 'Comparison of requested colour palettes.'; +} +:> -

-
-

88-colour space

+sub colorder { + my ($palette, $reorder) = @_; + return [ map { $palette->[$_] =~ s/:(?![^:])|$/:$_/r } @{$reorder} ] + if $reorder; + return $palette; +} -
-

256-colour space

+coltable($_) for @termlist; +:> +