header
---------

---------
footer

• I wonder what the solution for Plain TeX is. – Palec Apr 4 '15 at 9:51

Your easiest approach here would be to include the fancyhdr package and set the header/footer rule widths using \renewcommand:

\documentclass{article}
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\pagestyle{fancy}% Change page style to fancy
\fancyfoot[C]{Footer}% \fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}% Default \footrulewidth is 0pt
\begin{document}
Here is some text.
\end{document}


Headers and footers are simultaneously cleared using \fancyhf{}, and individually set using \fancyhead[<pos>]{<stuff>} and \fancyfoot[<pos>]{<stuff>}. See the fancyhdr documentation.

Modifying the colour of the header/footer rules is a bit more tricky, since fancyhdr doesn't supply this modification by default. etoolbox can be used to update the two rule macros \headrule and \footrule to insert the colour as needed. They are defined as follows:

\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi

\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
\vskip-\footruleskip\vskip-\footrulewidth


It is clear that the horizontal rule is drawn using \hrule, so we can patch these commands and insert \color{<colour>} just before drawing it by means of the following convenient helper macros:

\usepackage{etoolbox,fancyhdr,xcolor}% http://ctan.org/pkg/{etoolbox,fancyhdr,xcolor}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}


This allows you to use \headrulecolor{<colour>} or \footrulecolor{<colour>} in order to change them individually. The above patch is standard for etoolbox, so see the etoolbox documentation on how \patchcmd works. Here's a complete MWE:

\documentclass{article}
\usepackage{etoolbox,fancyhdr,xcolor}% http://ctan.org/pkg/{etoolbox,fancyhdr,xcolor}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}
\pagestyle{fancy}
\fancyfoot[C]{Footer}% \fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}% Default \footrulewidth is 0pt
\begin{document}
Here is some text.
\end{document}


Here's another option using the titleps package:

\documentclass{article}
\usepackage{titleps}

\newpagestyle{ruled}
\setfoot{}{Footer}{}\footrule}
\pagestyle{ruled}

\begin{document}
Here is some text.
\end{document}


Redefining \makeheadrule and \makefootrule, you can change the attributes; for example, to change the color:

\documentclass{article}
\usepackage{xcolor}
\usepackage{titleps}

\newpagestyle{ruled}
\setfoot{}{Footer}{}\footrule}
\pagestyle{ruled}

\renewcommand\makefootrule{\color{cyan}\rule[\baselineskip]{\linewidth}{0.4pt}}

\begin{document}
Here is some text.
\end{document}


Of course, you can switch to other page style at any moment:

\documentclass{article}
\usepackage{titleps}

\newpagestyle{ruled}