I was wondering if there are any way to set the background color of the header part (the one that contains personal info) of a file that uses moderncv
in order to visually differentiate the header and the content.
I tried with minipage
, \hfill
and so on but I guess that moderncv
uses a heavily customized template and everything I've tried so far lead to a compile error.
Best Answer
One option using the
tikzmark
library:You place some mark(s) using
\tikzmark
and then use those marks to draw a rectangle filled with the desired color. In my example code I usedwhich draws a rectangle having opposite vertices in
(current page.north west)
(i.e., the upper left corner of the page) and in the point with coordinates([yshift=-1cm]current page.east|-{pic cs:end})
(this means 1cm below the point that has the same x-coordinate as the leftmost end of the page and the y-coordinate of the point markedend
); theend
mark was placed inside\extrainfo
which was the lowest element used in the personal information. I also placed astart
mark in the upper field of the personal information, but I never used this mark.Feel free to change the colors, and position of the colored background, according to your needs.