The custom header feature allows the user to set the color of the header text. But what if you’d like for the site title to be a different color than the site tagline? This is an issue I just hit in the GovPress theme I’ve been working on.
To solve it I added an additional option to the theme customizer:
https://gist.github.com/devinsays/b5cbe81ce737f0f7e463
In my inline styles, I output the color option:
https://gist.github.com/devinsays/13c75347b239bfb938c0
Escaping the color option output
Kirk Wright and Zach Tollman both mentioned escaping the output of the the color option in the comments below, so I’ve updated the above code snippet to include sanitize_hex_color. However, this function isn’t available when the theme customizer isn’t loaded- so that will also need to be added to your code:
https://gist.github.com/devinsays/ea3b18acc2eccf02a927
Post Message Support
I also have postMessage support so the updated colors appear instantly, but I’ll let you pick through the code if you’d like to update that.
Check out this code (with additional options as well) on GitHub:
https://github.com/govfresh/govpress/blob/master/inc/customizer.php.