termcol: default values for rgb table colours
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 1 Nov 2015 03:03:20 +0000 (04:03 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 5 Jan 2016 00:05:07 +0000 (01:05 +0100)
Continue with an equally distributed palette if unspecified.

termcol.plp

index e34ceada9d45204cf9af827be33092b71fe5f069..ead8cb5d9e812522967a4c45bed4f0d2b46e533b 100644 (file)
@@ -233,6 +233,8 @@ sub coltable_hsv {
        my $hmax = 2 * $dim * 3;  # each face of the rgb cube
        my $vmax = $dim - 1;
        my $smax = $dim - 1;
+       $rgbval ||= sub { int $_[0] * 255 / $vmax };
+       $greyramp ||= [];
 
        my %greymap;  # name => value
        my @colmap;  # saturation => value => hue => [name, r,g,b]