Is it possible to create a TOC with section headings in one color and subsection headings in different color.
\tableofcontents
\setcounter{tocdepth}{2}
I am using above lines to create TOC, do I need to use any special package?
Is it possible to create a TOC with section headings in one color and subsection headings in different color.
\tableofcontents
\setcounter{tocdepth}{2}
I am using above lines to create TOC, do I need to use any special package?
You could use the tocloft package for customizing the table of contents.
Without an additional package, you could modify the class macros which are responsible for the table of contents entries, such as \l@section and \l@subsection.
Here is an example for the article class:
\documentclass[11pt]{article}
\usepackage[svgnames]{xcolor}
\makeatletter
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
\stdl@section{\textcolor{blue}{#1}}{\textcolor{blue}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
\stdl@subsection{\textcolor{DarkGreen}{#1}}{\textcolor{DarkGreen}{#2}}}
\makeatother
\setcounter{tocdepth}{2}
\begin{document}
\tableofcontents
\section{Section One}
\subsection{Subsection One}
\subsection{Subsection Two}
\section{Section Two}
\subsection{Subsection One}
\subsection{Subsection Two}
\end{document}

I've just solve it!
\usepackage{tocloft}
\renewcommand{\cftsubsubsecfont}{\color{ColorTerciario}}
\renewcommand{\cftsubsubsecaftersnumb}{\hspace{0.5em}}
\makeatletter %colorear la tabla de contenidos, extraído de http://tex.stackexchange.com/questions/7526/toc-section-subsection-coloring/56368#56368
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
\stdl@section{\textcolor{ColorPrincipal}{#1}}{\textcolor{ColorPrincipal}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
\stdl@subsection{\textcolor{ColorSecundario}{#1}}{\textcolor{ColorSecundario}{#2}}}
The space can be varied with the cftsubsubsecaftersnumb.