Advertisement
Squito

Színek

Jan 20th, 2020
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <table>
  2. <?PHP
  3. $col=0;
  4. for($r=0;$r<=255;$r++)
  5. {
  6.     $red=dechex($r);
  7.     if($r<16)
  8.     {
  9.         $red='0'.$red;
  10.     }
  11.     for($g=0;$g<=255;$g++)
  12.     {
  13.         $green=dechex($g);
  14.         if($g<16)
  15.         {
  16.             $green='0'.$green;
  17.         }
  18.         for($b=0;$b<=255;$b++)
  19.         {
  20.             $blue=dechex($b);
  21.             if($b<16)
  22.             {
  23.                 $blue='0'.$blue;
  24.             }
  25.             if($col==0)
  26.             {
  27.                 echo '<tr>';
  28.             }
  29.             echo '<td><input type="button" onclick="document.body.style.backgroundColor = '."'#".$red.$green.$blue."'".'" value="#'.$red.$green.$blue.'"></td>';
  30.             if($col==20)
  31.             {
  32.                 echo '<tr>';
  33.             }
  34.             $col++;
  35.             if($col>20)
  36.             {
  37.                 $col=0;
  38.             }
  39.         }
  40.     }
  41. }
  42. ?>
  43. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement