X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/803fc2946b1c6a3b876cabea90ebac62ca6e55a9..03abf85a7ec9775993766a3fd10cd2876aef0b42:/termcol.plp diff --git a/termcol.plp b/termcol.plp index d4cd63f..571b296 100644 --- a/termcol.plp +++ b/termcol.plp @@ -2,7 +2,7 @@ Html({ title => 'terminal colour cheat sheet', - version => '1.0', + version => '1.1', description => [ "Index of all terminal/console colour codes,", "with an example result of various environments.", @@ -18,7 +18,7 @@ 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'; +push @termlist, split /\W+/, $Request || 'default'; :>

Terminal colours

@@ -35,14 +35,13 @@ print
<: -use 5.010; use Shiar_Sheet::Colour 1.04; use List::Util qw( min max ); use POSIX qw( ceil ); my $palettes = do 'termcol.inc.pl'; die "Cannot open palette data: $_\n" for $@ || $! || (); -my $more = do 'termcol-xcolor.inc.pl'; +my $more = do 'termcol-xcolor.inc.pl' || {}; $palettes = {%$palettes, %$more}; sub colcell { @@ -106,7 +105,7 @@ sub coltable { coltable($_) for @{$info}; } - ref $info eq 'HASH' or next; + ref $info eq 'HASH' or return; my $caption = $info->{name} // $term; $caption = sprintf('<%s %s>%s', @@ -120,15 +119,15 @@ sub coltable { ) if $info->{href} or $info->{title}; if (my $mapinfo = $info->{rgbmap}) { - print ''."\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; print coltable_hsv(@{$mapinfo}); - print "
%s
\n\n"; + say "\n"; } if (my $table = $info->{table}) { - print ''."\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; for my $row (@$table) { print ''; print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row; @@ -143,7 +142,7 @@ sub coltable { print "
%s
", img_egapal(\@imgpal, @{$_}); } } - print "
\n\n"; + say "\n"; } if (my $palette = $info->{list}) { @@ -155,8 +154,8 @@ sub coltable { my $rows = 8; my $columns = ceil(@{$palette} / $rows); - print '', "\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; for my $row (0 .. $rows - 1) { print ''; for my $col (0 .. $columns - 1) { @@ -175,7 +174,7 @@ sub coltable { ); print "
%s
", img_egapal($imgpal, @{$_}); } - print "
\n\n"; + say "\n"; } }