git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
charset: prefer manual definitions over continuations
[sheet.git]
/
termcol.plp
diff --git
a/termcol.plp
b/termcol.plp
index 8f8878bf498535442122a16eb28284432786b016..6f7a55d979cf7a6d14fcac0839019c828232fce2 100644
(file)
--- a/
termcol.plp
+++ b/
termcol.plp
@@
-2,7
+2,7
@@
Html({
title => 'terminal colour cheat sheet',
Html({
title => 'terminal colour cheat sheet',
- version => '1.
0
',
+ version => '1.
1
',
description => [
"Index of all terminal/console colour codes,",
"with an example result of various environments.",
description => [
"Index of all terminal/console colour codes,",
"with an example result of various environments.",
@@
-36,12
+36,14
@@
print
<div class="section">
<:
use 5.010;
<div class="section">
<:
use 5.010;
-use Shiar_Sheet::Colour
'1.04'
;
+use Shiar_Sheet::Colour
1.04
;
use List::Util qw( min max );
use POSIX qw( ceil );
my $palettes = do 'termcol.inc.pl';
die "Cannot open palette data: $_\n" for $@ || $! || ();
use List::Util qw( min max );
use POSIX qw( ceil );
my $palettes = do 'termcol.inc.pl';
die "Cannot open palette data: $_\n" for $@ || $! || ();
+my $more = do 'termcol-xcolor.inc.pl';
+$palettes = {%$palettes, %$more};
sub colcell {
my $name = shift // return "<td>\n";
sub colcell {
my $name = shift // return "<td>\n";
@@
-129,14
+131,18
@@
sub coltable {
printf "<caption>%s</caption>\n", $caption;
for my $row (@$table) {
print '<tr>';
printf "<caption>%s</caption>\n", $caption;
for my $row (@$table) {
print '<tr>';
- print colcell(
@$_
) for @$row;
+ print colcell(
ref $_ ? @$_ : $_ ? reverse split /:/ : undef
) for @$row;
}
}
+ if (@draw) {
my $width = scalar @{ $table->[0] };
my $width = scalar @{ $table->[0] };
- my @imgpal = map { [ @{$_}[1 .. 3] ] } map { @{$_} } @{$table};
+ my @imgpal = map {
+ [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ]
+ } map { @{$_} } @{$table};
for (@draw) {
print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
}
for (@draw) {
print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
}
+ }
print "</table>\n\n";
}
print "</table>\n\n";
}