Good morning, I have just seen a Question titled by ''How to change the color of Table of Contents from red to black?'' and I'm really satisfied by the proposed answer as I want, knowing that the table of contents and the page numbers are both hyperlinked.

{ \hypersetup{linkcolor=black}
\tableofcontents
}


• Either to change the color of the page numbers in this table to red
• Or frame these page numbers in a color square.
• Not sure, if this is what you want to achieve, but \usepackage[colorlinks=true,linktocpage=true]{hyperref} removes the hyperlinks from the titles in the table of contents, hyperlinks the corresponding page numbers instead and prints these numbers in red. By removing the option colorlinks=true, the page numbers are surrounded by a red frame. – leandriis Dec 8 '17 at 10:20

You wrote,

I would like to ... change the color of the page numbers [in the ToC] [to red]

I suggest you load the hyperref package with the option linktocpage.

\documentclass{article}

• @AH - Just remove the option colorlinks. If necessary, specify the option linkcolor=red when loading hyperref. – Mico Dec 10 '17 at 17:31