php颜色方案查看器 - 逝去的青春

php颜色方案查看器

作者:jao 发布于:2012-12-16 12:41 分类:PHP教程

01 <?php
02 /**
03  * color scheme analyzer
04  * works with any amount of colors, just change the array
05  * this example uses the solarized color scheme <http://ethanschoonover.com/solarized>
06  */
07 $pallette array(
08     'base03' => '#002b36',
09     'base02' => '#073642',
10     'base01' => '#586e75',
11     'base00' => '#657b83',
12     'base0' => '#839496',
13     'base1' => '#93a1a1',
14     'base2' => '#eee8d5',
15     'base3' => '#fdf6e3',
16     'yellow' => '#b58900',
17     'orange' => '#cb4b16',
18     'red' => '#dc322f',
19     'magenta' => '#d33682',
20     'violet' => '#6c71c4',
21     'blue' => '#268bd2',
22     'cyan' => '#2aa198',
23     'green' => '#859900',
24 ); ?>
25 <style type="text/css">
26 table {border-collapse:collapse; width:100%; font-weight:bold;}
27 tr {margin:0; padding:0; height:30px;}
28 td {margin:0; padding:0; width:<?php echo round(100/(count($pallette)+1), 2);?>%;}
29 </style>
30 <table>
31 <?php foreach($pallette as $color1=>$hex1):?>
32     <tr style="background-color:<?php echo $hex1;?>">
33     <td><?php echo $color1;?></td>
34 <?php foreach(array_reverse($palletteas $color2=>$hex2):?>
35         <td style="color:<?php echo $hex2;?>"><?php echo $color2;?></td>
36 <?php endforeach;?>
37     </tr>
38 <?php endforeach;?>
39 </table>
40                         

标签: php教程 PHP 颜色

et_highlighter
Copyright © 2012-2013 逝去的青春 蜀ICP备13029051号-1 手机版 安全联盟 Theme by Admin73 sitemap