git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b10a187
)
termcol: exclude monochromatic xcolors palettes
author
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 23 Oct 2016 05:47:20 +0000
(07:47 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Wed, 22 Mar 2017 21:28:04 +0000
(22:28 +0100)
tools/mktermcol-xcolor
patch
|
blob
|
history
diff --git
a/tools/mktermcol-xcolor
b/tools/mktermcol-xcolor
index 2d007bcf924ddf4db39ed6318e1f7ebbe45a8a99..59c4a259bba9eb630fc3bad646121725f286f09f 100755
(executable)
--- a/
tools/mktermcol-xcolor
+++ b/
tools/mktermcol-xcolor
@@
-1,6
+1,8
@@
#!/usr/bin/env perl
use 5.010;
#!/usr/bin/env perl
use 5.010;
+use Shiar_Sheet::Colour '1.05';
+
say 'use strict;';
say '+{';
my @names;
say 'use strict;';
say '+{';
my @names;
@@
-8,7
+10,6
@@
my @names;
for my $path (glob 'data/xcolors/themes/*') {
open my $theme, '<', $path;
(my $name = $path) =~ s{.*/}{}; # basename
for my $path (glob 'data/xcolors/themes/*') {
open my $theme, '<', $path;
(my $name = $path) =~ s{.*/}{}; # basename
- push @names, $name;
my @pal;
while (readline $theme) {
my @pal;
while (readline $theme) {
@@
-19,11
+20,26
@@
for my $path (glob 'data/xcolors/themes/*') {
$pal[$idx] = $val;
}
$pal[$idx] = $val;
}
+ my $huesum = 0;
+ for my $hue (
+ sort map { $_->hue }
+ grep { ($_->hsv)[1] > 32 } # ignore unsaturated
+ map { Shiar_Sheet::Colour->new($_) }
+ @pal
+ ) {
+ state $lasthue;
+ $huesum += abs($lasthue - $hue) > .02 if defined $lasthue;
+ $lasthue = $hue;
+ }
+ $huesum > 3 or next; # require number of significant hue changes
+ #TODO tweak to include good-pants, exclude cheesecake-*
+
say qq("$name" => {);
say qq(\ttitle => '$name',);
say qq(\tparent => 'cga',);
say qq(\tlist => [qw(@pal)],);
say qq(},);
say qq("$name" => {);
say qq(\ttitle => '$name',);
say qq(\tparent => 'cga',);
say qq(\tlist => [qw(@pal)],);
say qq(},);
+ push @names, $name;
}
say 'xcolor => [', join(', ', map {"'$_'"} @names), '],';
}
say 'xcolor => [', join(', ', map {"'$_'"} @names), '],';