# Can't change the colour of the line in the header (fancyhdr)

I'm trying to change the colour of the line in my header to the grey, and I don't know how to do it correctly.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  % Включаем пакет для поддержки русского
\usepackage[a4paper, portrait, margin=1in, hmargin=1.3cm, top=4cm, bottom=4cm, headheight=3cm, footskip=2.5cm]{geometry}
%\usepackage[tiny]{titlesec}
\usepackage{fancyhdr}
\usepackage{tabu}
\usepackage{xcolor}
% not sure is it a right command
%    }

\fancypagestyle{prefirstpage}
{
\hline
\begin{tabu} to \textwidth { |X[0.15,l,p]|X[0.25,l,p]|X[0.25,l,p]|X[0.4,l,p]|}
\taburulecolor{gray}
& \multicolumn{2}{l|}{Adress} &   \\ [10ex] \hline
& \textbf{№ УКД:} & \textbf{ Версия:}  & \textbf{Страниц:}  \\ \hline
\end{tabu}
%not sure is it right command
}
}
\begin{document}
\pagestyle{prefirstpage}

\end{document}


What I want to have is:

• As usual: Your example is not compilable:-( Which rule shall be changed? The table rule or the fancyhdr rules? You write of header but the title speaks of footer? – user31729 Mar 22 '16 at 10:37
• @ChristianHupfer rule in the header – Lucky_girl Mar 22 '16 at 10:44
• You just edited the title, but the error is still in the code! – user31729 Mar 22 '16 at 10:46

The fancyhdr package already provides support for headrules with \headrule and \headrulewidth. The colour is a little bit tricky, but can be used as well by storing the old code in a \oldheadrule command and using {\color{\headrulecolour}\oldheadrule}} (note the grouping {})

There is a clear warning about headheight being too small, that's why I increased it.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  % Включаем пакет для поддержки русского
\usepackage[a4paper, portrait, margin=1in, hmargin=1.3cm, top=5.5cm, bottom=4cm, headheight=125pt, footskip=2.5cm]{geometry}
\usepackage{fancyhdr}
\usepackage{tabu}
\usepackage[svgnames,x11names,dvipsnames]{xcolor}

\providecommand{\copyid}{4711}
\providecommand{\varVersion}{3.14159}

\fancypagestyle{prefirstpage}
{
\begin{tabu} to \textwidth { |X[0.15,l,p]|X[0.25,l,p]|X[0.25,l,p]|X[0.4,l,p]|}
\hline
\taburulecolor{gray}
& \multicolumn{2}{l|}{Adress} &   \\ [10ex] \hline
& \textbf{№ УКД:} \copyid{}  & \textbf{ Версия:} \varVersion{} & \textbf{Страниц:}  \\ \hline
\end{tabu}
}

• @Lucky_girl: You defined it to be grey and the thickness is from your .3\baselineskip command --> all is from your settings! There is predefined colour named grey, but Grey which is pretty dark. You can use white!70!black to setup a light gray colour, however – user31729 Mar 22 '16 at 11:04
• @Lucky_girl: 0.5\baselineskip is even bigger! See my edit, please! – user31729 Mar 22 '16 at 11:08