X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/ede7dd9ecdc525c8323ea16805f983786fb00c1a..77ac3d52d89913a79cca834d882c54a58c15a488:/tools/mktermcol-xcolor diff --git a/tools/mktermcol-xcolor b/tools/mktermcol-xcolor index f731e5a..7f39c80 100755 --- a/tools/mktermcol-xcolor +++ b/tools/mktermcol-xcolor @@ -1,14 +1,19 @@ #!/usr/bin/env perl -use 5.010; +use 5.014; -use Shiar_Sheet::Colour '1.05'; +use Shiar_Sheet::Colour 1.05; +say "# automatically generated by $0"; say 'use strict;'; say '+{'; my @names; +my %seen; -for my $path (glob 'data/xcolors/themes/*') { - open my $theme, '<', $path; +for my $path (@ARGV) { + open my $theme, '<', $path or do { + warn "could not open $path: $!\n"; + next; + }; (my $name = $path) =~ s{.*/}{}; # basename my (%pal, @pal); @@ -37,6 +42,13 @@ for my $path (glob 'data/xcolors/themes/*') { $huesum > 3 or next; # require number of significant hue changes #TODO tweak to include good-pants, exclude cheesecake-* + if ($seen{"@pal"}++) { + warn "ignore duplicate palette $name\n"; + next; + } + + splice @pal, 8 if "@pal[0..7]" eq "@pal[8..15]"; + say qq("$name" => {); say qq(\ttitle => '$name',); say qq(\tparent => 'cga',);