Seydie

Color table

Nov 30th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.             <?php
  2.                 echo '<table border="1" cellpadding="2">';
  3.                 $kleuren = array('00','33','66','99','cc','ff');
  4.                
  5.                 for ($red = 0; $red < 6; $red++) {
  6.                    
  7.                     for ($green = 0; $green < 6; $green++) {
  8.                         echo '<tr>';
  9.  
  10.                         for ($blue = 0; $blue < 6; $blue++) {
  11.                             $color = $kleuren[$red].$kleuren[$green].$kleuren[$blue];
  12.                             $colorinv = $kleuren[5-$red].$kleuren[5-$green].$kleuren[5-$blue];
  13.                            
  14.                            
  15.                             if ($kleuren[$red] == "ff" && $kleuren[$green] == "ff" && $kleuren[$blue] == "ff") {
  16.                                 echo '<th' . ' style="background-color:#' . $color  . ';' . 'color:black;' . '">' . '#' . $color .'</th>';
  17.                             }
  18.                            
  19.                             else {
  20.                                 echo '<th' . ' style="background-color:#' . $color . ';' . $colorinv . ';">' . '#' . $color . '</th>';
  21.                             }
  22.                         }
  23.                         echo '</tr>';
  24.                     }
  25.                 }
  26.  
  27.         echo '</table>';
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment