Posted By

DanielFGray on 10/31/11


Tagged

php pattern viewer color grid scheme analyzer colorscheme


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Net-Freak


php color-scheme viewer


 / Published in: PHP
 

  1. <?php
  2. /**
  3.  * color scheme analyzer
  4.  * works with any amount of colors, just change the array
  5.  * this example uses the solarized color scheme <http://ethanschoonover.com/solarized>
  6.  */
  7. $pallette = array(
  8. 'base03' => '#002b36',
  9. '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($pallette) as $color2=>$hex2):?>
  35. <td style="color:<?php echo $hex2;?>"><?php echo $color2;?></td>
  36. <?php endforeach;?>
  37. </tr>
  38. <?php endforeach;?>
  39. </table>

Report this snippet  

You need to login to post a comment.