Saturday, 27 July 2013

All possible combination of CSS color code


Want 2 se all 16777216 shades of color,just run the above script*.I was struggling with the color code and this came to my mind.....
*I am not responsible if your PC hangs while executing this :p
This requires changes in php.ini file or you'll get an time-out error and memory error :p
Just manupulate the loops an get different shades of particular color :D
<?php
$i=0;
$j=0;
$k=0;
$op='';
$count='';
for($i=0;$i<256;$i++){
    for($j=0;$j<256;$j++){
        for($k=0;$k<256;$k++){
           $op.="<div style='background-color:rgb($i,$j,$k);width:80px;height:20px;'></div>rgb($i,$j,$k)<br/>";
            $count++;
        }
    }
}

?>
<html>
   
    <body>
        <?php
        echo "$count<br/>";
        echo "$op.";
         ?>
   </body>
 </html>

No comments:

Post a Comment