termcol: hue order for ppu tables
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 2 May 2017 20:45:13 +0000 (22:45 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:23:11 +0000 (19:23 +0200)
termcol.inc.pl
termcol.plp

index 520dbe2636a3cbe18bc78a085151bda89318628f..3411852b135d522ad44e20d73c5c73781b17415a 100644 (file)
@@ -323,6 +323,7 @@ use Shiar_Sheet::Colour 1.05;
                                ] } 0..13
                        }
                ],
                                ] } 0..13
                        }
                ],
+               hueorder => [6..12, 1..5, 13, 0],
        },
        shovel => {
                name => 'NES for Shovel Knight',
        },
        shovel => {
                name => 'NES for Shovel Knight',
@@ -344,6 +345,7 @@ use Shiar_Sheet::Colour 1.05;
                        [qw( 22123B:0S 360900:1S 824E00:2S 9E9E5C:3S )],
                ],
                parent => 'ppu',
                        [qw( 22123B:0S 360900:1S 824E00:2S 9E9E5C:3S )],
                ],
                parent => 'ppu',
+               hueorder => [6..12, 1..5, 13, 0, 14],
        },
 
        64 => {
        },
 
        64 => {
index 3880a62ecd46bca9ff202616ba3ecd1032df0661..6d69f0c1b798f33328951f5bef3cf754f40e91b5 100644 (file)
@@ -115,6 +115,8 @@ sub coltable {
        }
 
        ref $info eq 'HASH' or return;
        }
 
        ref $info eq 'HASH' or return;
+       my $order = $get{order} && $get{order}.'order';
+       my $reorder = $info->{$order} // $palettes->{ $info->{parent} }->{$order};
 
        my $caption = $info->{name} // $term;
        $caption = sprintf('<%s %s>%s</%1$s>',
 
        my $caption = $info->{name} // $term;
        $caption = sprintf('<%s %s>%s</%1$s>',
@@ -134,6 +136,8 @@ sub coltable {
                print coltable_hsv(@{$_}) for $info->{rgbmap} || ();
 
                if (my $table = $info->{table}) {
                print coltable_hsv(@{$_}) for $info->{rgbmap} || ();
 
                if (my $table = $info->{table}) {
+                       $table = [ @{$table}[@{$reorder}] ] if $reorder;
+
                        for my $row (@$table) {
                                if (!$row) {
                                        say '<tbody>';
                        for my $row (@$table) {
                                if (!$row) {
                                        say '<tbody>';
@@ -158,10 +162,7 @@ sub coltable {
        }
 
        if (my $palette = $info->{list}) {
        }
 
        if (my $palette = $info->{list}) {
-               my $order = $get{order} && $get{order}.'order';
-               my $colours = colorder($palette,
-                       $info->{$order} // $palettes->{ $info->{parent} }->{$order}
-               );
+               my $colours = colorder($palette, $reorder);
 
                my $rows = 8;
                my $columns = ceil(@{$palette} / $rows);
 
                my $rows = 8;
                my $columns = ceil(@{$palette} / $rows);