<(common.inc.plp)><:
+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/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.1',
+ version => '1.4',
description => [!$Request ? "Comparison of various colour palettes." : (
"Index of all terminal/console colour codes,",
"with an example result of various environments.",
});
my @draw = map { [$_, s/\W+\z//] } grep { $_ } split m(/),
- $get{img} // exists $get{img} && 'indi.png';
+ $get{img} // exists $get{img} && 'compile.png';
my @termlist;
push @termlist, split /\W+/, $Request || 'default';
use List::Util qw( min max );
use POSIX qw( ceil );
-my $palettes = do 'termcol.inc.pl';
-die "Cannot open palette data: $_\n" for $@ || $! || ();
+my $palettes = Data('termcol');
sub colcell {
my $name = shift // return "<td>\n";