PHP 生成一個顏色選擇面板 (Color Palette)
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>
本文由用戶 ebey2291 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!