[Tex/LaTex] Set Header Background and Text Color Using fancyhdr

colorfancyhdr

Is there any way to set the header background color using fancyhdr?

The doc's don't make mention of color so, I think I may be barking up the wrong tree. If fancyhdr can't do this are there any other package suggestions?

My preamble is very simple;

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\lhead{REST API Reference (v12.011918)}
\rhead{\thepage}
\cfoot{Company, Inc.}

I simply need to set the background to red and the text to white.

Thanks!

Best Answer

enter image description here

\documentclass{article}



\usepackage{fancyhdr,color}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{17pt}
\lhead{
\textcolor{red}{\rule[-2pt]{\textwidth}{15pt}}%
\hspace{-\textwidth}%
\textcolor{white}{REST API Reference (v12.011918)}}
\rhead{\textcolor{white}{\thepage}}
\cfoot{Company, Inc.}
\begin{document}
zz
\end{document}