termcol: separate gameboy table rows in cpcboy
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 2 May 2017 20:36:06 +0000 (22:36 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:23:11 +0000 (19:23 +0200)
termcol.inc.pl
termcol.plp

index 38696ce..520dbe2 100644 (file)
@@ -266,10 +266,11 @@ use Shiar_Sheet::Colour 1.05;
                                        54BF47 37C79F 35CFE4  8DD836 B8D1B5 97E9D1  EDD446 EBE4A4 FFFFFF
                                )]->[$index]
                        },
-                       [ # gameboy ramp
-                               map { [ 27 + (state $index)++, map { hex } /(..)/g ] }
-                               qw( F2EFE7 BAC375 859550 485D48 293941 )
-                       ],
+               ],
+               table => [
+                       # gameboy ramp
+                       [qw( 293941:31       :   F2EFE7:27 )],
+                       [qw( 485D48:30 859550:29 BAC375:28 )],
                ],
                parent => 'cpc',
        },
@@ -288,7 +289,6 @@ use Shiar_Sheet::Colour 1.05;
                        [qw(         0 6C71C4:3J         0 )],
                        [qw( 362747:1K 75507B:3K F06FCB:5K )],
                        [qw(         0 D33662:3L         0 )],
-                       undef,
                        [qw( 000000:0  686868:2  CCCCCC:4  )],
                        [qw( 444444:1  B0B0B0:3  FFFFFF:5  )],
                ],
index 26a5c70..a090fc7 100644 (file)
@@ -127,16 +127,13 @@ sub coltable {
                $caption,
        ) if $info->{href} or $info->{title};
 
-       if (my $mapinfo = $info->{rgbmap}) {
+       if ($info->{table} or $info->{rgbmap}) {
                say '<table class="color mapped">';
                say sprintf '<caption>%s</caption>', $caption;
-               print coltable_hsv(@{$mapinfo});
-               say "</table>\n";
-       }
 
-       if (my $table = $info->{table}) {
-               say '<table class="color mapped">';
-               say sprintf '<caption>%s</caption>', $caption;
+               print coltable_hsv(@{$_}) for $info->{rgbmap} || ();
+
+               if (my $table = $info->{table}) {
                for my $row (@$table) {
                        if (!$row) {
                                say '<tbody>';
@@ -155,6 +152,8 @@ sub coltable {
                        print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
                }
        }
+               }
+
                say "</table>\n";
        }