X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/dae21a09b01baa118720670247a87c5cdc2591b8..4f3782455010e83df98953a4fa4f146577b9a888:/termcol.plp diff --git a/termcol.plp b/termcol.plp index 359b33d..850ff83 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,149 +1,249 @@ -<: -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 @draw = map { [$_, s/\W+\z//] } grep { $_ } split m(/), + $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 mirc legacy ansi256 )], + msx => [qw( msx1 msx2 arnejmp )], + ansi => [qw( cga xterm tango app html cgarne )], + 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.04'; +use List::Util qw( min max ); +use POSIX qw( ceil ); - -

Terminal colours

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

88-colour space

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

256-colour space

+:>

- - -