I was bored and learned a little bit of php today (never done php/html/etc before) and thought this was a cool idea.
Every time you refresh the page it'll be a different color.
I do realize I should probably center it with css, but I'll update that in a few.
It'll also display the hex value of the color.
View a live example here:
http://mslcoding.com/dev/color.php
<html>
<?php
$color=rand(1,100000);
$x="#".$color;
$hex= $x;
?>
<body bgcolor="<?php echo $x; ?>" </body>
<br><br><br><br>
<div align="center">
<font size="10"><?php echo $hex ?> Press f5</>
</div>
</html>
You're using a number selection only. Where as #dedede which is a valid hex colour will never show because it's not numbers.. Kind of hard to explain how hexadecimal works...
Sorry if you already know and this is condecending.. :p Denary is 0-9, Hex is 0-15 per unit. When you get past 9, it goes from A onwards. i.e denary 10 = hex A.
you're using rand(1,100000) to generate a random integer RGB value whereas the range of possible values is much larger: 0 to 2^24-1 = 16777215.
thus if you want to select from the range of all possible RGB values, you should use rand(0, 16777215)
edit: is #N a valid colour if N is expressed in base10?