Color the background of the paper in latex

backgroundscolor

How to color the background of the paper in latex?

I want my document to have every other page coloring i.e., say I want the papers to be light blue and light pink alternatively, how can I do this?

Note that, I did not start my document yet, my document size will be about 6 or 8 pages. I prefer using document class book or article.

Best Answer

You can tap into the shipout routine and change the colour based on the value of the page number:

enter image description here

\documentclass{article}

\usepackage{kantlipsum}
\usepackage{xcolor}

\AddToHook{shipout/before}{%
  \ifodd\value{page}
    \pagecolor{blue!5!white}% Odd page colour (light blue)
  \else
    \pagecolor{red!5!white}% Even page colour (light red)
  \fi
}

\begin{document}

\kant[1-50]

\end{document}