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