X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/187b633a5aec45e26a6a8df9dbd71207307474db..0f1f7a00062360f4b373f027a2a3fa8d43cacd06:/termcol.plp diff --git a/termcol.plp b/termcol.plp index 2674fc9..c58670c 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,143 +1,161 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; -use List::Util 'min'; - -our $VERSION = 'v1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; - -:> - - - -terminal colour cheat sheet - - - - - +<(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'], +}); + +:>

Terminal colours

- -
-

88-colour space

+sub coltable_hsv { + my ($dim, $rgbval, $greyramp) = @_; -
-

256-colour space

+ my $out = ''; + $out .= sprintf '', 3 * @{$_} 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; + } -
+ $offset += $dim ** 3; + $greymap{$offset++} = $_ for @{$greyramp}; - + $out .= ''; + my $col = 0; + my $colbreak = scalar map { @$_ } @colmap; # same width as hue rows + for my $num (sort { $greymap{$a} <=> $greymap{$b} } keys %greymap) { + $out .= '' unless $col++ % $colbreak; + $out .= colcell($num, ($greymap{$num}) x 3); + } + + return $out; +} + +:> +
-