From 16b530ef1bda793f687168797b982d2c504efc81 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 21 Dec 2015 00:59:59 +0100 Subject: [PATCH] termcol: parent attribute to inherit common palette order Facilitates other fallbacks in the future. --- termcol.inc.pl | 9 ++++----- termcol.plp | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/termcol.inc.pl b/termcol.inc.pl index ac21a9c..168894f 100644 --- a/termcol.inc.pl +++ b/termcol.inc.pl @@ -2,8 +2,6 @@ use strict; use 5.010; use Shiar_Sheet::Colour '1.02'; -my @msxorder = ( 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ); - +{ html => { title => 'HTML keywords (inherited by CSS≥2.1 and SVG), mostly identical to X11', @@ -160,7 +158,7 @@ my @msxorder = ( 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ); 0.53;0.27;0.93 0.67;0.27;0.93 0.73;0.07;0.57 0.80;0.17;0.57 0.47;0.23;0.13 0.53;0.67;0.73 0.80;0.47;0.47 1.00;0.47;0.47 )], - ansiorder => \@msxorder, + ansiorder => [ 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ], }, msx2 => { name => 'MSX2', @@ -169,7 +167,7 @@ my @msxorder = ( 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ); 000 000 161 373 117 237 511 267 711 733 661 663 141 625 555 777 )], - ansiorder => \@msxorder, + parent => 'msx1', }, arnejmp => { href => 'http://androidarts.com/palette/16pal.htm', @@ -179,7 +177,7 @@ my @msxorder = ( 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ); 000000 191028 46AF45 A1D685 453E78 7664FE 833129 9EC2E8 DC534B E18D79 D6B97B E9D8A1 216C4B D365C8 AFAAB9 F5F4EB )], - ansiorder => \@msxorder, + parent => 'msx1', }, arnegame => { href => 'http://androidarts.com/palette/16pal.htm', @@ -222,6 +220,7 @@ my @msxorder = ( 0,6,12,10,4,13,7,14 , 1,8,2,11,5,9,3,15 ); qw( F2EFE7 BAC375 859550 485D48 293941 ) ], ], + parent => 'cpc', }, ansi88 => { name => 'rxvt 88 colour extension', diff --git a/termcol.plp b/termcol.plp index b3bb7b5..92bc4f8 100644 --- a/termcol.plp +++ b/termcol.plp @@ -128,7 +128,10 @@ for my $term (@termlist) { } if (my $palette = $info->{list}) { - my $colours = colorder($palette, $get{v} && $info->{ansiorder}); + my $order = $get{v} && 'ansiorder'; + my $colours = colorder($palette, + $info->{$order} // $palettes->{ $info->{parent} }->{$order} + ); my $rows = 8; my $columns = ceil(@{$palette} / $rows); @@ -148,7 +151,9 @@ for my $term (@termlist) { } for (@draw) { - my $imgpal = colorder($palette, $info->{ansiorder}); + my $imgpal = colorder($palette, + $info->{ansiorder} // $palettes->{ $info->{parent} }->{ansiorder} + ); print "", img_egapal($imgpal, @{$_}); } print "\n\n"; -- 2.30.0