Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (56 sloc) 1.681 kb
<?php
header("Content-type: text/css");
$spotcolor = $_GET["spotcolor"];
if (!preg_match("/[0-9a-f]{6}/i", $spotcolor)) {
die();
}
$spotcolor = "#$spotcolor";
/**
* Gets the simple #rrggbb color triplet corresponding to the given triplet at
* the given CSS opacity, against a white background.
*/
function bw_get_color_with_opacity($triplet, $opacity) {
$rgb = hexdec(substr($triplet, 1));
return '#' . dechex(0xff - (0xff - (($rgb & 0xff0000) >> 16)) * $opacity) .
dechex(0xff - (0xff - (($rgb & 0x00ff00) >> 8)) * $opacity) .
dechex(0xff - (0xff - (($rgb & 0x0000ff) )) * $opacity);
}
?>
a:link {
color: <?php echo $spotcolor; ?>;
}
a:visited {
color: <?php echo bw_get_color_with_opacity($spotcolor, 0.75); ?>;
}
#wrapper {
border: 3px solid <?php echo $spotcolor; ?>;
}
#wrapper > header h1 {
background: <?php echo $spotcolor; ?>;
}
#wrapper > header nav {
background: <?php echo bw_get_color_with_opacity($spotcolor, 0.5); ?>;
}
#wrapper > header nav .current-menu-item > a {
color: <?php echo $spotcolor; ?>;
}
#wrapper > header .menu {
border-bottom-color: <?php echo bw_get_color_with_opacity($spotcolor, 0.75); ?>;
}
#wrapper > footer {
background: <?php echo $spotcolor; ?>;
}
h1.entry-title, .entry-title h1 {
color: <?php echo $spotcolor; ?>;
}
.staff h1 {
color: <?php echo $spotcolor; ?>;
}
#home-featured article {
background: <?php echo $spotcolor; ?>;
}
#home-featured .tray .selected {
border-color: <?php echo $spotcolor; ?>;
color: <?php echo $spotcolor; ?>;
background: <?php echo bw_get_color_with_opacity($spotcolor, 0.25); ?>;
}
Jump to Line
Something went wrong with that request. Please try again.