With the hyperref package I make all links in the document (scrbook) blue and all headings are blue too. However, in the toc I just want to have the chapters blue and everything else black. How can this be achieved?
Thanks in advance!
With the hyperref package I make all links in the document (scrbook) blue and all headings are blue too. However, in the toc I just want to have the chapters blue and everything else black. How can this be achieved?
Thanks in advance!
Unfortunately, there is no MWE (minimal working example) in the question, and I am not sure I understand what you are trying to do. If the links are the same color as the headings in the document and the links in the table of contents are different colors, nobody knows what a link is and what is not a link.
Nevertheless it is possible to have blue links and headings and in TOC only blue chapter entries:
\documentclass{scrbook}
\usepackage{blindtext}% only for dummy text
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue
}
\AfterTOCHead[toc]{\hypersetup{linkcolor=.}}% use current color as linkcolor in TOC
\addtokomafont{disposition}{\color{blue}}% blue headings
%% uncomment for chapter entries with black pagenumbers:
%\DeclareTOCStyleEntry[pagenumberformat=\usekomafont{disposition}\normalcolor]{chapter}{chapter}
\begin{document}
\tableofcontents
\chapter{First chapter}
See section \ref{sec1}
\section{First section}\label{sec1}
\blinddocument
\end{document}
Result:
Uncommenting
\DeclareTOCStyleEntry[pagenumberformat=\usekomafont{disposition}\normalcolor]{chapter}{chapter}
you will get black page numbers for the chapter entries in TOC.
If the entries in LOF and LOT should use the normal color too, remove the optional argument from \AfterTOCHeand:
\AfterTOCHead{\hypersetup{linkcolor=.}}% use current color as linkcolor in TOC, LOF and LOT