The website background colour is stored in a cookie, and can be set from the Styles/Colours page.
The brightness check is to stop people using a colour which is too light, lest the white text become unreadable
<?php header("Content-type:text/CSS");
SetColour($_COOKIE["StyleColour"]);
function SetColour($Colour){
if(preg_match("/^([0-9A-Fa-f]{2}){3}$/",$Colour, $Matches) &&
TestDarkness($Matches))
BackgroundColour($Colour);
else
BackgroundColour("339576"); // Default
}
function BackgroundColour($Colour){
printf("body{background-color: #%s;color:#FFF;}\n",$Colour);
}
function TestDarkness($Matches){
$Brightness = (0 + hexdec($Matches[1]) +
hexdec($Matches[2]) +
hexdec($Matches[3]));
return($Brightness < 3 * 0xA0);
}
?>
a:link, a:visited{color:#AFC}