Reply to Re: [PHP] Font color

Your name:

Reply:


Posted by trlists on 04/16/05 07:14

Here is a little code that shows the "web-safe" colors and their
"opposites" using the algorithm I described in the previous message:

<html>
<head>
<title Web-safe color 'opposites'>
</head>
<body>
<?php

# Display color opposites for web colors
$weblist = array('00', '33', '66', '99', 'CC', 'FF');
print("<table cols=\"4\" cellspacing=\"5\" cellpadding=\"0\">");
print("<tr>\n");
print("<th align=\"right\">Color</td>\n");
print("<th width=\"100\" align=\"center\">Color swatch</td>\n");
print("<th width=\"100\" align=\"center\">'Opposite' swatch</td>\n");
print("<th align=\"left\">'Opposite' color</td>\n");
print("</tr>\n");
foreach ($weblist as $red) {
foreach ($weblist as $green) {
foreach ($weblist as $blue) {
$hexcolor = $red . $green . $blue;
$hexoppcolor = sprintf("%06X", (hexdec($hexcolor) ^ 0xFFFFFF));
print("<tr>\n");
print("<td align=\"right\">#$hexcolor</td>\n");
print("<td width=\"100\" height=\"20\"
bgcolor=\"#$hexcolor\">&nbsp;</td>\n");
print("<td width=\"100\" height=\"20\"
bgcolor=\"#$hexoppcolor\">&nbsp;</td>\n");
print("<td align=\"left\">#$hexoppcolor</td>\n");
print("</tr>\n");
}
}
}
print("</table>\n");
?>
</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация