Code tested in Firefox browser as random.php
Code:
<?php
$r = rand(128,255);
$g = rand(128,255);
$b = rand(128,255);
$tablebg = dechex($r) . dechex($g) . dechex($b);
?>
<html>
<head>
<title> Refresh and see </title>
</head>
<body bgcolor='<?php echo "#"."$tablebg"; ?>'>
This is my Home page with random background color. <br>
Refresh and see.
</body>
</html>
Light colors are selected using $r = rand();. If you change the $r = rand(128,255); to $r = rand(0,255); deep color will be set as background color, which will cause difficulty in reading the text in the web page.
Bookmarks