[Tex/LaTex] How to change the color of the table of contents

colortable of contents

What is the best way to change the color of the entire table of contents. I saw a lot of tutorials but it's complicated for me (I am a beginner).

Best Answer

If I understand your objective correctly, you wish to change the color that's used for all elements of the Table of Contents; these include, presumably, the title of the ToC.

To do so, you could load the xcolor package and insert the instruction \color{blue} -- or whatever color you wish to apply -- before \tableofcontents. To limit the scope of the \color instruction, encase it and the material it's supposed to apply to in a set of \begingroup and \endgroup statements.

enter image description here

\documentclass{article}
\usepackage{xcolor} %% http://www.ctan.org/pkg/xcolor
\begin{document}
\begingroup % start a TeX group
\color{blue}% or whatever color you wish to use
\tableofcontents
\endgroup   % end of TeX group

\section{A}
\section{B}
\end{document}