From ede7dd9ecdc525c8323ea16805f983786fb00c1a Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 29 Oct 2016 17:25:31 +0200 Subject: [PATCH 1/1] termcol: include named xcolors colours Preserve foreground and background for future distinction from 7/0. --- tools/mktermcol-xcolor | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/mktermcol-xcolor b/tools/mktermcol-xcolor index 59c4a25..f731e5a 100755 --- a/tools/mktermcol-xcolor +++ b/tools/mktermcol-xcolor @@ -11,13 +11,16 @@ for my $path (glob 'data/xcolors/themes/*') { open my $theme, '<', $path; (my $name = $path) =~ s{.*/}{}; # basename - my @pal; + my (%pal, @pal); while (readline $theme) { - m{ color(\d+) \h* : \h* ( \#(\S+) | rgb:(\S+) ) }x or next; - my ($idx, $val) = ($1, uc $+); - $idx < 16 or next; + m{ + (?: (foreground | background) | color(\d+) ) \h* : \h* + (?: \#(\S+) | rgb:(\S+) ) + }x or next; + my ($name, $idx, $val) = ($1, $2, uc $+); + $name or $idx < 16 or next; $val =~ s/[^0-9A-F]//g; - $pal[$idx] = $val; + ($name ? $pal{$name} : $pal[$idx]) = $val; } my $huesum = 0; @@ -38,6 +41,7 @@ for my $path (glob 'data/xcolors/themes/*') { say qq(\ttitle => '$name',); say qq(\tparent => 'cga',); say qq(\tlist => [qw(@pal)],); + say qq(\t$_ => '$pal{$_}',) for keys %pal; say qq(},); push @names, $name; } -- 2.30.0