-all: digraphs.inc.pl unicode-cover.inc.pl countries.inc.pl data/browser/support.inc.pl
+all: digraphs.inc.pl unicode-cover.inc.pl countries.inc.pl data/browser/support.inc.pl termcol-xcolor.inc.pl
more: all data/digraphs-xorg.inc.pl
download: data/DerivedAge.txt data/rfc1345.txt data/xorg-compose data/countryInfo.txt data/caniuse.json
ttfsupport/%.inc.pl: tools/mkttfinfo data/font/%.ttf
$< $(word 2,$^) $@ || true
+termcol-xcolor.inc.pl: tools/mktermcol-xcolor
+ $< >$@
+
.SECONDARY:
data/font/%.ttf:
find /usr/share/fonts/truetype/ ~/.fonts/ -iname "$(@F)" | head -1 | xargs -i ln -sf {} $@
my $palettes = do 'termcol.inc.pl';
die "Cannot open palette data: $_\n" for $@ || $! || ();
+my $more = do 'termcol-xcolor.inc.pl';
+$palettes = {%$palettes, %$more};
sub colcell {
my $name = shift // return "<td>\n";
--- /dev/null
+#!/usr/bin/env perl
+use 5.010;
+
+say 'use strict;';
+say '+{';
+my @names;
+
+for my $path (glob 'data/xcolors/themes/*') {
+ open my $theme, '<', $path;
+ (my $name = $path) =~ s{.*/}{}; # basename
+ push @names, $name;
+
+ my @pal;
+ while (readline $theme) {
+ m{ color(\d+) \h* : \h* ( \#(\S+) | rgb:(\S+) ) }x or next;
+ my ($idx, $val) = ($1, uc $+);
+ $idx < 16 or next;
+ $val =~ s/[^0-9A-F]//g;
+ $pal[$idx] = $val;
+ }
+
+ say qq("$name" => {);
+ say qq(\ttitle => '$name',);
+ say qq(\tparent => 'cga',);
+ say qq(\tlist => [qw(@pal)],);
+ say qq(},);
+}
+
+say 'xcolor => [', join(', ', map {"'$_'"} @names), '],';
+say '}';