git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
termcol: list 256-colour hues starting with red
[sheet.git]
/
termcol.plp
diff --git
a/termcol.plp
b/termcol.plp
index 74bcbc4ae7f7fde7044bdc5f5a9f927e2b2c88b3..5a4e83eed9b4b285bdfdb2edcdd55f3fad308da0 100644
(file)
--- a/
termcol.plp
+++ b/
termcol.plp
@@
-28,7
+28,7
@@
print
<div class="section">
<:
<div class="section">
<:
-use Shiar_Sheet::Colour '1.0
2
';
+use Shiar_Sheet::Colour '1.0
3
';
use List::Util qw( min max );
sub colcell {
use List::Util qw( min max );
sub colcell {
@@
-259,18
+259,17
@@
for my $r (0 .. 5) {
my $index = $r*6*6 + $g*6 + $b + 16;
my @rgb = map { $_ && $_*40 + 55 } $r, $g, $b;
my $index = $r*6*6 + $g*6 + $b + 16;
my @rgb = map { $_ && $_*40 + 55 } $r, $g, $b;
- my $h = Shiar_Sheet::Colour->new(@rgb)->hue * 3
5
;
+ my $h = Shiar_Sheet::Colour->new(@rgb)->hue * 3
3
;
my $v = int(max(@rgb) / 255 * 5);
my $s = abs(min(@rgb) - max(@rgb)) / 255 * 7;
my $grey = !$s;
my $v = int(max(@rgb) / 255 * 5);
my $s = abs(min(@rgb) - max(@rgb)) / 255 * 7;
my $grey = !$s;
- $h-- for grep {$h >= $_} 4, 6, 16, 19, 28, 31;
$v = 5 - $v;
$s = 7 - $s - $v;
$s-- if $s;
if ($grey) {
$v = 5 - $v;
$s = 7 - $s - $v;
$s-- if $s;
if ($grey) {
- $h = 3
0
; # greyscale hue
+ $h = 3
3
; # greyscale hue
$s -= 2; # lowest saturation for other hues
$v = $s = 0 if $s < 0; # black at full saturation
}
$s -= 2; # lowest saturation for other hues
$v = $s = 0 if $s < 0; # black at full saturation
}
@@
-283,7
+282,7
@@
for my $r (0 .. 5) {
{
print '<table class=mapped>';
printf '<colgroup span=%d>', 3 * @{$_} for @colmap;
{
print '<table class=mapped>';
printf '<colgroup span=%d>', 3 * @{$_} for @colmap;
- for my $h (
0 .. 30
) {
+ for my $h (
grep { $colmap[0][0][$_] } 0 .. $#{ $colmap[0][0] }
) {
print '<tr>';
print colcell(@$_) for map { $_->[$h] } map { @{$_} } @colmap;
}
print '<tr>';
print colcell(@$_) for map { $_->[$h] } map { @{$_} } @colmap;
}