X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/dae21a09b01baa118720670247a87c5cdc2591b8..HEAD:/termcol.plp diff --git a/termcol.plp b/termcol.plp index 359b33d..f76e293 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,149 +1,289 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; -use List::Util 'min'; +<(common.inc.plp)><: -our $VERSION = 'v1.0'; +if (my ($name) = $Request =~ /(.+)\.gpl\z/) { + my $palettes = Data('termcol'); + my $palette = $palettes->{$name} + or Abort("Palette '$name' not found", 404); + ref $palette ne 'ARRAY' + or Abort("Group contains multiple palettes: ".join(', ', @{$palette})); -$header{content_type} = 'text/html; charset=utf-8'; + $header{content_type} = 'text/x-gimp-gpl'; + say 'GIMP Palette'; + say 'Name: ', $palette->{name} // $name; + say 'Columns: 8'; + say '#'; + for (@{ $palette->{list} }) { + my ($rgb, $name) = split /:/, $_, 3; + say join ' ', unpack('C*', pack 'H6', $rgb), $name; + } + exit; +} -:> - +Html({ + title => ($Request ? 'terminal colour' : 'colour palettes') . ' cheat sheet', + version => '1.4', + 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'], +}); - -terminal colour cheat sheet - - - +my @draw = map { [$_, s/\W+\z//] } grep { $_ } split m(/), + $get{img} // exists $get{img} && 'compile.png'; - -

Terminal colours

+my @termlist; +push @termlist, split /\W+/, $Request || 'default'; - -
-

88-colour space

+ if (my $palette = $info->{list}) { + my $colours = colorder($palette, $reorder); -
-

256-colour space

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