in reply to A hierarchy of color (intensity)?
#! /usr/bin/perl -w use strict; use warnings; my @websafe = qw / 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF /; print <<EOF; <html> <head> <style> td {font-size: xx-small;} </style> </head> <body> <h1>Colour Table</h1> <table> EOF my $bg; my $lum; my $fg; foreach my $red (reverse @websafe) { foreach my $green (@websafe) { print "<tr>"; foreach my $blue (@websafe) { $lum = (hex ($red) * 0.3) + (hex ($green) * 0.59) + (hex($ +blue) * 0.11); $fg = $lum < 128 ? "#FFFFFF" : "#000000"; print "<td bgcolor= \"#$red$green$blue\"><font color=\"$fg +\">#$red$green$blue</font></td>"; } print "</tr>\n"; } } print <<EOF; </table> </body> </html> EOF
|
---|