You can apply a style to the header <div>
(or the <header>
element), and then add an inline style using wp_add_inline_style()
.
For example, let’s say you’ve got something like this in your header.php
file:
<header id="masthead" class="site-header" role="banner">
(Cribbed from the Twenty Twelve theme.)
Let’s say you’ve set up the neighborhood’s color as post meta-information using update_post_meta()
or perhaps a custom metabox of some sort. Now we can pull it out of the meta table and throw it into the inline styles:
add_action( 'wp_enqueue_scripts', 'wpse115373_header_bg' );
function wpse115373_header_bg() {
global $post;
// set this to the handle of one of your stylesheets
$handle="twentytwelve-style";
// set this to the meta key you've used
$meta_key = 'neighborhood_color';
$bg_color = get_post_meta( $post->ID, $meta_key, $single = true );
$css = "header { background-color: $bg_color; }";
wp_add_inline_style( $handle, $css );
}
Reference
Codex pages for: