PHP 生成一个颜色选择面板 (Color Palette)
2018-07-20 来源:open-open
webcolor.php
<html>
<head>
<title>Web-Safe Color Palette</title>
</head>
<body>
<table>
<tr>
<?php
$i = 1;
$row_size = 18;
for($red = 0; $red <= 5; $red++)
for($green = 0; $green <= 5; $green++) {
for($blue = 0; $blue <= 5; $blue++)
{
$red_hex = str_pad(dechex($red * 51), 2, "0", STR_PAD_LEFT);
$green_hex = str_pad(dechex($green * 51), 2, "0", STR_PAD_LEFT);
$blue_hex = str_pad(dechex($blue * 51), 2, "0", STR_PAD_LEFT);
$hex_color = $red_hex . $green_hex . $blue_hex;
print("<td bgcolor=\"#$hex_color\" width=\"15\"> </td>");
if(($i % $row_size) == 0)
print("</tr><tr>");
$i++;
}
}
?>
</tr>
</table>
</body>
</html>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐