common: enable perl v5.14 features everywhere
[sheet.git] / termcol.plp
index 3d807a242c7272253672a941db9d0d5ca1655955..fbf7fe462fd8427f08efbc53d43912030ba3b4a5 100644 (file)
@@ -2,7 +2,7 @@
 
 Html({
        title => 'terminal colour cheat sheet',
-       version => '1.0',
+       version => '1.1',
        description => [
                "Index of all terminal/console colour codes,",
                "with an example result of various environments.",
@@ -35,8 +35,7 @@ print
 
 <div class="section">
 <:
-use 5.010;
-use Shiar_Sheet::Colour '1.04';
+use Shiar_Sheet::Colour 1.04;
 use List::Util qw( min max );
 use POSIX qw( ceil );
 
@@ -131,14 +130,18 @@ sub coltable {
                printf "<caption>%s</caption>\n", $caption;
                for my $row (@$table) {
                        print '<tr>';
-                       print colcell(@$_) for @$row;
+                       print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row;
                }
 
+       if (@draw) {
                my $width = scalar @{ $table->[0] };
-               my @imgpal = map { [ @{$_}[1 .. 3] ] } map { @{$_} } @{$table};
+               my @imgpal = map {
+                       [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ]
+               } map { @{$_} } @{$table};
                for (@draw) {
                        print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
                }
+       }
                print "</table>\n\n";
        }