Afficher la palette de couleur RGB

Author:


Download

<html>
<head>
<title> Palette de Couleur</title>
</head>
<body>
<table>
<tr>
<?php
     $i = 1;
     $nombre_ligne = 18;

     for($rouge = 0; $rouge <= 5; $rouge++)
     for($vert = 0; $vert <= 5; $vert++) {
          for($bleu = 0; $bleu <= 5; $bleu++)
          {
               $rouge_hex = str_pad(dechex($rouge * 51), 2, "0", STR_PAD_LEFT);
               $vert_hex = str_pad(dechex($vert * 51), 2, "0", STR_PAD_LEFT);
               $bleu_hex = str_pad(dechex($bleu * 51), 2, "0", STR_PAD_LEFT);
               $couleur_hex = $rouge_hex . $vert_hex . $bleu_hex;

               print("<td bgcolor='#$couleur_hex' width='15'>&nbsp;</td>");

               if(($i %$nombre_ligne) == 0)
                    print("</tr><tr>");

               $i++;
          }
     }
?>
</tr>
</table>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *


1 × two =