# Change Color, Pitch, Line Style of Showframe (Geometry Package)

How can one change the colour, pitch, line style, etc of the rules generated by the geometry package's showframe option?

-

The internal macro \Gm@pageframes sets the frames, thus it can be extended to add a color:

\documentclass{article}
\usepackage{lipsum,microtype}
\usepackage[a6paper,showframe]{geometry}
\usepackage{xcolor}

\colorlet{showframe}{red}
\makeatletter
\let\org@Gm@pageframes\Gm@pageframes
\renewcommand*{\Gm@pageframes}{%
\begingroup
\color{showframe}%
\org@Gm@pageframes
\endgroup
}
\makeatother

\begin{document}
\section{Hello World}
\lipsum[2]
\end{document}


-

\documentclass[a4paper]{scrartcl}
\usepackage{xcolor}
\usepackage[showframe]{geometry}
\usepackage{microtype}
\usepackage{lipsum}
\makeatletter
\def\Gm@hrule{\color{red!20}\hrule height 4pt depth\z@ width\textwidth}%
\def\Gm@vrule{\color{red!20}\vrule width 4pt height\textheight depth\z@}%
\def\Gm@hruled{\color{red!20}\hrule height\z@ depth4pt width\textwidth}%

\makeatother

\title{How to change the color of \texttt{showframe}}
\author{Fran}
\date{\today}
\begin{document}
\maketitle

\section{Introduction}

You need change the rules. Not all those of the society, but only the three
defined in \verb|geometry.sty| with the macros
\verb|\Gm@vrule|  \verb|\Gm@hrule| and  \verb|\Gm@hruled|.
Thus, simply define again these rules in your preamble, adding some color.
Of course, include before the  \verb|color| or \verb|xcolor| package.

As these commands contain the character @, remember that you need put
these definitions in a  \verb|\makeatletter| \dots  \verb|\makeatother| group.

The rest of this the \verb|lipsum| dummy text of any decent
minimal  working example.
You do not need read the following text.  \lipsum[1]

\lipsum[2-3]

\end{document}

-