Journal /

Written by Aman Anderson
February 13, 2011 at 16:21
Category
Code
Comments
2

Now this little code is so helpful. It basically generates random code for your background like here on my website. It’s nice because other JavaScript generators select hard to read colours, but with this you can select your own HEX colors. Pretty sweet, heres the code:

<?php
$c1 = "#ffcc00";
$c2 = "#ffff99";
$c3 = "#cfeef6";
$c4 = "#b2ebc5";
$c5 = "#ffffff";
$c6 = "#d7ebff";
$c7 = "#dfceb9";
$c8 = "#b3ccc5";

$number = rand(1,8);
$bgcolour = ${"c$number"};
echo ("<BODY BGCOLOR=\"$bgcolour\">");
?>