Re: Font color

From: Date: Sat, 16 Apr 2005 04:14:39 +0000
Subject: Re: Font color
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213173@lists.php.net to get a copy of this message
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>

« previous php.general (#213173) next »