<:
sub luminance {
# perceived brightness (using ITU-R recommendation 601 luma co-efficients)
@@ -38,8 +34,9 @@ sub colcell {
my $rgb48 = '';
$rgb48 .= sprintf '%02X', $_ for @rgb[0..2];
my $inverse = sprintf('%X', luminance(@rgb)/255 < .3 ? 12 : 0) x 3;
- return sprintf '%s | %s | %s'."\n",
- "background:#$rgb48; color:#$inverse",
+ return sprintf ' | %s | %s | %s'."\n",
+ join(',', map { int } @rgb[0..2]),
+ "background:#$rgb48; color:#$inverse; padding:0 1ex",
$id,
"background:#000; color:#$rgb48",
$rgb24,
@@ -77,7 +74,6 @@ my %col = (
);
for my $term (qw/html cga xterm tango/) {
- print '', "\n";
print '', "\n";
print "$term\n";
for my $num (0 .. 15) {
@@ -85,15 +81,17 @@ for my $term (qw/html cga xterm tango/) {
print '',
colcell($col{"-$term"}[$num] || $num, $rgb, $col{$term}[0]);
}
- print " \n\n";
+ print "\n\n";
}
-:>
+:>
-88-colour space
+
+
+88-colour space
<:
for my $r (0 .. 3) {
- print '';
+ print '';
for my $g (0 .. 3) {
print '';
for my $b (0 .. 3) {
@@ -105,16 +103,19 @@ for my $r (0 .. 3) {
}
print "\n";
-print '';
-print colcell(80, ($_) x 3) for 46, 92, 115, 139, 162, 185, 208, 231;
+print '';
+print colcell(80+$_, (($_ + 2 + ($_>0)) * 255/11) x 3) for 0 .. 7;
print " \n\n";
-:>
+:>
+<: if ($ENV{PATH_INFO} =~ /256/) { :>
-256-colour space
+
+
+256-colour space
<:
for my $r (0 .. 5) {
- print '';
+ print '';
for my $g (0 .. 5) {
print '';
for my $b (0 .. 5) {
@@ -127,21 +128,13 @@ for my $r (0 .. 5) {
print "\n";
for my $row (0, 12) {
- print '';
+ print '';
print colcell(232+$_, ($_*10 + 8) x 3) for $row .. $row+11;
print " \n";
}
print "\n";
-:>
+:>
+<: } :>
-
-
-
|