4 use Shiar_Sheet::Colour '1.05';
10 for my $path (@ARGV) {
11 open my $theme, '<', $path or do {
12 warn "could not open $path: $!\n";
15 (my $name = $path) =~ s{.*/}{}; # basename
18 while (readline $theme) {
20 (?: (foreground | background) | color(\d+) ) \h* : \h*
21 (?: \#(\S+) | rgb:(\S+) )
23 my ($name, $idx, $val) = ($1, $2, uc $+);
24 $name or $idx < 16 or next;
25 $val =~ s/[^0-9A-F]//g;
26 ($name ? $pal{$name} : $pal[$idx]) = $val;
32 grep { ($_->hsv)[1] > 32 } # ignore unsaturated
33 map { Shiar_Sheet::Colour->new($_) }
37 $huesum += abs($lasthue - $hue) > .02 if defined $lasthue;
40 $huesum > 3 or next; # require number of significant hue changes
41 #TODO tweak to include good-pants, exclude cheesecake-*
44 say qq(\ttitle => '$name',);
45 say qq(\tparent => 'cga',);
46 say qq(\tlist => [qw(@pal)],);
47 say qq(\t$_ => '$pal{$_}',) for keys %pal;
52 say 'xcolor => [', join(', ', map {"'$_'"} @names), '],';