+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;
+}
+