From: Mischa POSLAWSKY Date: Sun, 1 Nov 2015 19:06:34 +0000 (+0100) Subject: termcol: move common styling to css include X-Git-Tag: v1.9~76 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/0c4ea1b3f69fa7595057e3744f6d46c1ce7f3e46 termcol: move common styling to css include Reduces page size from 109kB to 88kB (though only 400 bytes over 12kB compressed) for 140 bytes general css (35 bytes or less download). --- diff --git a/base.css b/base.css index 7b8586e..eb18128 100644 --- a/base.css +++ b/base.css @@ -232,7 +232,7 @@ th, tfoot td, thead td { border: 0; - background: transparent !important; + background: transparent; } .glyphs thead td { width: auto; /* no glyph cells in header */ @@ -256,6 +256,17 @@ tfoot .cat th { border-top: 1px solid #888; } +/* colour map */ + +table.color th { + border: 1px solid #555; + font-weight: normal; + padding: 0 1ex; +} +table.color th ~ td { + font-family: monospace; +} + /* digraphs map */ table.dimap { diff --git a/termcol.plp b/termcol.plp index 32a7356..e544bf7 100644 --- a/termcol.plp +++ b/termcol.plp @@ -58,12 +58,12 @@ sub colcell { my $sample = [ qw(#000 #FFF) ]; ($name, $sample) = @$name if ref $name eq 'ARRAY'; - my $out = sprintf('%s', + my $out = sprintf('%s', join(',', map { int } @$col), - "background:$css; color:$inverse; padding:0 1ex", + "background:$css; color:$inverse", $name, ); - $out .= sprintf '%s', "background:$_; color:$css", $minhex + $out .= sprintf '%s', "background:$_; color:$css", $minhex for @$sample; return "$out\n"; } @@ -83,7 +83,7 @@ for my $term (@termlist) { ) if $info->{href} or $info->{title}; if (my $mapinfo = $info->{rgbmap}) { - print ''."\n"; + print '
'."\n"; printf "\n", $caption; print coltable_hsv(@{$mapinfo}); print "
%s
\n\n"; @@ -94,7 +94,7 @@ for my $term (@termlist) { $colours = [ map { $colours->[$_] =~ s/:|$/:$_/r } @{$reorder} ]; } - print '', "\n"; + print '
', "\n"; printf "\n", $caption; for my $num (0 .. $#{$colours}) { my ($rgb, $name) = split /:/, $colours->[$num], 3;
%s