There're other previous questions about using a color background with fancyhdr so that you get a colored header and/or footer. However, they discuss either using a different color box for each part of the header, or working with a single part header (i.e: a header with just the center part, for example).
But what if I have a complete header with three parts (left, center, and right), and I want all the three parts inside a single colored box?
Ideally, the colored box should have no margins, but the three header parts should keep their original margins, so I guess I cannot use the fancyhdr margin parameters for that.
I really need to use fancyhdr for the header. I can add more packages if necessary, but the header must still be created with fancyhdr.
Best Answer
Unfortunaly there is no MWE in the question. So here is only a suggestion that works for a simple three part header using package
fancyhdr
.Or starting with KOMA-Script version 3.19
With
scrlayer-scrpage
it is also easy to color the top margin including the header.If you want to use
fancyhdr
instead you can draw the background image using TikZ with theremember picture,ovelay
options. So you have to run the code twice to get the rectangle on the right position.