note 79805 deleted from function.dechex by felipe
| From: | felipe@php.net | Date: | Sat, 15 Dec 2007 15:20:05 +0000 |
| Subject: | note 79805 deleted from function.dechex by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133562@lists.php.net to get a copy of this message | ||
Note Submitter: Adrien Boeglin
Reason: 1
----
Some fastly-made Websafe colors table based on dechex().
<html>
<style media="all">
td {
padding: 10px;
border: 1px solid black;
}
</style>
<table>
<caption>Websafe Colors</caption>
<?php
$Red = 0;
$Green = 0;
$Blue = 0;
While ($Blue <= 255) {
while ($Green <= 255) {
echo "\t",'<tr>',"\n";
while ($Red <= 255) {
if ($Red == 0) { $str_Red = "00"; } else { $str_Red = dechex($Red); }
if ($Red == 255) { $str_r_Red = "00"; } else { $str_r_Red = dechex(255-$Red); }
if ($Green == 0) { $str_Green = "00"; } else { $str_Green = dechex($Green); }
if ($Green == 255) { $str_r_Green = "00"; } else { $str_r_Green = dechex(255-$Green); }
if ($Blue == 0) { $str_Blue = "00"; } else { $str_Blue = dechex($Blue); }
if ($Blue == 255) { $str_r_Blue = "00"; } else { $str_r_Blue = dechex(255-$Blue); }
echo "\t\t",'<td
bgColor="#'.$str_Red.$str_Green.$str_Blue.'">';
echo '<b><font
color="'.$str_r_Red.$str_r_Green.$str_r_Blue.'">#';
echo $str_Red.$str_Green.$str_Blue.'</font></b>';
echo '</td>',"\n";
$Red = $Red + 51;
}
echo "\t",'</tr>',"\n";
$Green = $Green + 51;
$Red = 0;
}
$Blue = $Blue + 51;
$Green = 0;
}
?>
</table>
</html>