===== Safe Colours in the Web =====
==== The colour scheme ====
'; echo "# $ROT $GRUEN $BLAU | \n"; } // for $B echo "
";
Colour numbers are given in XHTML style; for HTML style, you may "double" the values, so ''#c3f'' becomes ''#cc33ff''.
==== and the source code: ====
echo '
Of course the "central" ''echo'' invocation can be written another way:
' . "\n";
for ($R = 0x0; $R <= 0xf; $R += 0x3) {
$ROT = sprintf("%x", $R);
$tf = ($R == 0xf) ? "#000" : "#fff";
for ($G = 0x0; $G <= 0xf; $G += 0x3) {
echo "
\n";
\n";
$GRUEN = sprintf("%x", $G);
if ($G >= 0xc) { $tf = "#000"; }
for ($B = 0x0; $B <= 0xf; $B +=0x3) {
$BLAU = sprintf("%x", $B);
echo ' \n";
} // for $G
} // for $R
echo "';
echo "# $ROT $GRUEN $BLAU \n";
} // for $B
echo "
echo '
';
If you want to change the output so that HTML values are displayed, you have to make following modifications:
* the condition for the loop reads ''%%<%%= 0xff''
* the loop counter is incremented with ''+= %%0x33%%''
* the output changes to ''%02x'' (results in 00 bis ff) or ''%02X'' (results in 00 bis FF)