Coloring toc page numbers

I'm using book class and I'm trying to achieve a toc which titles and page numbers are all clickable and hyperlinked to their corresponding sections, but with the characteristic that the page numbers have different color from their sections.

I think I need to set something inside \hypersetup, but I can't figure out how to do it.

I have tried using:

\hypersetup{linktocpage}


But it only makes clickable the page numbers; I'd like to make both page numbers and titles clickable. Here is my complete code and a picture of what I'm trying to get:

\documentclass[a4paper,11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{palatino}
\usepackage[english,spanish,activeacute]{babel}
\usepackage{enumerate}
\usepackage{minitoc}
\usepackage[dvipsnames,table]{xcolor}

\begin{document}
\dominitoc
\setcounter{secnumdepth}{6} \setcounter{tocdepth}{6}
\tableofcontents
\pagenumbering{arabic}

\chapter{Chapter 1}
Text
\section{Section 1}
Text
\subsection{Subsection 1}
Text
\subsubsection{Subsubsection 1}
Text

\end{document}


Thank you so much!

• Welcome to TeX.SX!. Please provide a compilable document, not just fragments. Using color and xcolor is useless, just use xcolor
– user31729
Mar 15 '16 at 19:33
• Sure! I have just updated my question. Thanks Mar 15 '16 at 19:48

The default setup with hyperref is to make only the sectional titles hyperlinked. However, you can use the linktoc key-value option to switch between

• none: Neither title nor page number is hyperlinked;
• section: Only section titles are hyperlinked;
• page: Only page entries are hyperlinked; and
• all: Both section titles and pages are hyperlinked.

The following minimal example changes the link colour of the page temporarily using the hooks provided by tocloft:

\documentclass{book}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{tocloft}

\makeatletter