# better default colors for hyperref links

There have been some complaints that the default colors of hyperref aren't so great. So here your chance for better defaults. Suggest a new set of color. The best one will be either the default (if we dare to change it) or added through an option, e.g. nicecolors.

(there is also a anchorcolor option, but the color isn't used anywhere so I left it out).

You can enter any color you want and in what ever syntax you prefer. Adding options to xcolor or loading some other package is fine too.

\documentclass{article}
\usepackage{xcolor}

%setup new colors
\hypersetup{
%,citecolor=
%,filecolor=
%,urlcolor=
%,runcolor=
%,citebordercolor=
%,filebordercolor=
%,urlbordercolor=
%,runbordercolor=
}
\begin{document}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{green}{green, citecolor}& \cite{cite} \\\\
\textcolor{cyan}{cyan, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{magenta}{magenta, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{cyan}{cyan, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{green}{green, citebordercolor}& \cite{cite} \\\\
\textcolor{teal}{teal, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor[rgb]{0,1,1}{rgb 0,1,1, urlbordercolor}& \url{https://www.latex-project.org/}\\\\
\textcolor[rgb]{0,0.7,0.7}{rgb 0,0.7,0.7, runbordercolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}


• I've used the following for a few books (we set file- and urlcolor to be the same): \definecolor{linkcolour}{rgb}{0,0.2,0.6}, \definecolor{citecolour}{rgb}{0,0.6,0.2}, \definecolor{urlcolour} {rgb}{0.8,0,0.8}, via \hypersetup{linkcolor=linkcolour,citecolor=citecolour,filecolor=urlcolour,urlcolor=urlcolour,} – daleif Jan 22 at 16:52
• @daleif you could make an answer. You only need to activate the linkcolor etc setting, e.g. linkcolor= {[rgb]{0,0.2,0.6}} – Ulrike Fischer Jan 22 at 16:56
• @daleif it doesn't matter much how you enter the colors here as it is only about finding better defaults - the internal representation will be probably different anyway. – Ulrike Fischer Jan 22 at 17:38
• I'd like to suggest the henryford color scheme. – David Carlisle Jan 22 at 19:52
• In my experience, most readers actually strongly appreciate if only one color (usually, but not necessarily, blue) is used for all hyperlinks -- regardless of whether they "point" to URLs, cross-referenced items, cited publications, footnotes, or what have you. Using different colors for all hyperlink targets quickly makes one's document look like an over-decorated Christmas tree. – Mico Jan 22 at 20:11

Here's a proposal (the default color column is (unsurprisingly) the default colour, and the example column is the ones I'm suggesting):

I tried to stick to darker colours because too bright ones, especially pure (#FFFF00), but also (#00FF00) and (#00FFFF), are terrible to read, both in PDF print. Note that in the picture above the menu colour is still a bit bright; yellow is not a good colour to put on a white background. . .

The first three colours I chose based on some colours I used for my own documents (one red, one green and one blue), and the other three I tried to pick so that they were different enough from the first ones. The border colours are the same as the text colours, except that they are mixed with white, so that the border doesn't punch you in the face when you look at it. I also changed the width of the border from 1 to 0.3, if that's a valid option.

I also tweaked the original colours I had so that they look different enough for people with the three severe types of colour blindness (colour blindness simulated using Color Oracle):

### Tritanopia (blue-blind):

I also chose less bright colours so that greyscale print of documents will also be readable (though hidelinks is a better option in this scenario). The brightest colour (the View Something text in the left column) is still darker than about half of the default colours (results may vary depending on how you compute brightness).

Here's the code:

\documentclass{article}
\usepackage{xcolor}
\usepackage[margin=1.5cm]{geometry}
\usepackage{multicol}

\def\tmp#1#2#3{%
\definecolor{Hy#1color}{#2}{#3}%
\hypersetup{#1color=Hy#1color}}
\tmp{cite}{HTML}{2E7E2A}
\tmp{file}{HTML}{131877}
\tmp{url} {HTML}{8A0087}
\tmp{run} {HTML}{137776}
\def\tmp#1#2{%
\colorlet{Hy#1bordercolor}{Hy#1color#2}%
\hypersetup{#1bordercolor=Hy#1bordercolor}}
\tmp{cite}{!60!white}
\tmp{file}{!60!white}
\tmp{url} {!60!white}
\tmp{run} {!60!white}

\begin{document}

\begin{multicols}{2}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{green}{green, citecolor}& \cite{cite} \\\\
\textcolor{cyan}{cyan, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{magenta}{magenta, urlcolor}& \url{www.latex-project.org}\\\\
\textcolor{cyan}{cyan, runcolor}  &  \href{run:sumatra}{run something}\\\\
\end{tabular}

You can read more in section~\ref{sec} and in~\cite{cite}. Both of which
contain a~\href{example-image.pdf}{file} that can also be found at
\url{www.latex-project.org}. Such file helps you \Acrobatmenu{View}{View
Something} or, alternatively \href{run:sumatra}{run something}, which is
rather nice.

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 0.3} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{green}{green, citebordercolor}& \cite{cite} \\\\
\textcolor{teal}{teal, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor[rgb]{0,1,1}{rgb 0,1,1, urlbordercolor}& \url{www.latex-project.org}\\\\
\textcolor[rgb]{0,0.7,0.7}{rgb 0,0.7,0.7, runbordercolor}  &  \href{run:sumatra}{run something}\\\\
\end{tabular}

You can read more in section~\ref{sec} and in~\cite{cite}. Both of which
contain a~\href{example-image.pdf}{file} that can also be found at
\url{www.latex-project.org}. Such file helps you \Acrobatmenu{View}{View
Something} or, alternatively \href{run:sumatra}{run something}, which is
rather nice.

\end{multicols}

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}

• Much better, because less hurting, colours. But the chance should be taken to unify the colour schemes for bordered and colour links. – AlexG Jan 23 at 6:45
• @AlexG You mean the exact same colours for <some>color and <some>bordercolor? I always disliked how striking is the appearance of those boxes (I never use the boxes, really), so I figured a lighter shade of the same colour would be better. – Phelype Oleinik Jan 23 at 11:19
• Yes, same colours. If at all, less saturated colours for colour links, perhaps. They weigh heavier than borders (need more ink) by nature. – AlexG Jan 23 at 11:41
• @AlexG They are the same colour (in some sense :-). The boxes (even if they weigh less than the colour links) look more intrusive to me (I'm biased though), that's why I mixed a bit with white. It doesn't look too bad if I remove the !60!white thing, but keep the thinner rule for the boxes... – Phelype Oleinik Jan 23 at 12:13

My personal preference would be that most link should be a uniform NavyBlue (vote here for that option).

Furthermore, the default should be colorlinks and not border. Borders are not easy to see and they are misrendered in Preview.app on macOS (see screenshot at end of this post). However, border don't print by default, so some may prefer them to colorlinks.

All that said, here is a proposal in which most types of links are still distinguishable. The most common types of links, i.e. internal link, and citations, are a different shade of the same colour that is currently used, so that people familiar with the meaning of these colours would not be confused. Weblinks are blue, as this is the de-fact standard on the web.

The screenshot is from Acrobat on macOS.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}

%setup new colors
\hypersetup{
,citecolor=Green
,filecolor=Mulberry
,urlcolor=NavyBlue
,runcolor=Mulberry
,citebordercolor=Green
,filebordercolor=Mulberry
,urlbordercolor=NavyBlue
,runbordercolor=Mulberry
}
\begin{document}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{Green}{Green, citecolor}& \cite{cite} \\\\
\textcolor{Mulberry}{Mulberry, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{NavyBlue}{NavyBlue, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{Mulberry}{Mulberry, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\subsection*{Example text}

You can read more in section~\ref{sec} and in~\cite{cite}. Both of which
contain a~\href{example-image.pdf}{file} that can also be found at
\url{www.latex-project.org}. Such file helps you \Acrobatmenu{View}{View
Something} or, alternatively \href{run:sumatra}{run something}, which is
rather nice.

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{Green}{Green, citebordercolor}& \cite{cite} \\\\
\textcolor{Mulberry}{Mulberry, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor{NavyBlue}{NavyBlue, urlbordercolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{Mulberry}{Mulberry, runbordercolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\subsection*{Example text}

You can read more in section~\ref{sec} and in~\cite{cite}. Both of which
contain a~\href{example-image.pdf}{file} that can also be found at
\url{www.latex-project.org}. Such file helps you \Acrobatmenu{View}{View
Something} or, alternatively \href{run:sumatra}{run something}, which is
rather nice.

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}


The following is what frequently happens in Preview.app on macOS when using a non-retina screen. Preview.app is one of the most common PDF viewers. Therefore, whether or not this is a bug in Preview, borders should not be the default. colorlinks is always better.

For voting purposes, I post a second answer in which most link types have the same colour. I chose NavyBlue for this because blue is the typical link colour on the web. Those link types which could be considered a security issue may have another, more alerting colour, such as Red. I will let others decide which link types should be highlighted this way. For this demo, I chose file, menu and run. Some may consider file links to be more akin to url links than to run links, and may therefore prefer them to be blue.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}

%setup new colors
\hypersetup{
,citecolor=NavyBlue
,filecolor=Red
,urlcolor=NavyBlue
,runcolor=Red
,citebordercolor=NavyBlue
,filebordercolor=Red
,urlbordercolor=NavyBlue
,runbordercolor=Red
}
\begin{document}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{NavyBlue}{NavyBlue, citecolor}& \cite{cite} \\\\
\textcolor{Red}{Red, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{NavyBlue}{NavyBlue, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{Red}{Red, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{NavyBlue}{NavyBlue, citebordercolor}& \cite{cite} \\\\
\textcolor{Red}{Red, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor{NavyBlue}{NavyBlue, urlbordercolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{Red}{Red, runbordercolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}


Somewhat in accordance with the 'henry ford color scheme' I suggest an even dark gray (60%) across all hyperrefs (with colorlinks as defaults as Szabolcs suggested). Additional bonuses are: No trouble with printing grayscale and no trouble with color vision deficiencies.

\documentclass{article}
\usepackage{xcolor}

\definecolor{darkgray}{HTML}{666666}
%setup new colors
\hypersetup{
,citecolor=darkgray
,filecolor=darkgray
,urlcolor=darkgray
,runcolor=darkgray
,citebordercolor=darkgray
,filebordercolor=darkgray
,urlbordercolor=darkgray
,runbordercolor=darkgray
}
\begin{document}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{green}{green, citecolor}& \cite{cite} \\\\
\textcolor{cyan}{cyan, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{magenta}{magenta, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{cyan}{cyan, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}
\bigskip

In running text \ref{sec} these \cite{cite} refs shoud still be quite visible: \href{example-image.pdf}{file}. Check \url{https://www.latex-project.org/} for more information, \Acrobatmenu{View}{View Something} if it helps, or even \href{run:sumatra}{run something}.

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{green}{green, citebordercolor}& \cite{cite} \\\\
\textcolor{teal}{teal, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor[rgb]{0,1,1}{rgb 0,1,1, urlbordercolor}& \url{https://www.latex-project.org/}\\\\
\textcolor[rgb]{0,0.7,0.7}{rgb 0,0.7,0.7, runbordercolor}  &  \href{run:sumatra}{run something}
\end{tabular}
\bigskip

In running text \ref{sec} these \cite{cite} refs shoud still be quite visible: \href{example-image.pdf}{file}. Check \url{https://www.latex-project.org/} for more information, \Acrobatmenu{View}{View Something} if it helps, or even \href{run:sumatra}{run something}.

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}


One could argue that the default colours do not need to distinguish between all six kinds of links. Semantically it makes sense to visually highlight the difference between internal links within the document, and external links to other files or web sites.

Here is a proposal using the popular 5-class RdBu color scheme from colorbrewer2.org which is both print friendly and colourblind safe. Using tex.stackexchange.com/a/117959/24165 the internal colour is also used for footnotes.

\documentclass{article}
\usepackage{xcolor}
\usepackage{etoolbox}

\makeatletter
\def\@footnotecolor{red}
\define@key{Hyp}{footnotecolor}{%
\HyColor@HyperrefColor{#1}\@footnotecolor%
}
\makeatother

\definecolor{intcolor}{HTML}{CA0020}
\definecolor{extcolor}{HTML}{0571B0}
%setup new colors
\hypersetup{
,citecolor=intcolor
,filecolor=extcolor
,urlcolor=extcolor
,runcolor=extcolor
,citebordercolor=intcolor
,filebordercolor=extcolor
,urlbordercolor=extcolor
,runbordercolor=extcolor
,footnotecolor=intcolor
}
\begin{document}

\begin{tabular}{lll}
default color\footnote{internal color used for footnotes}               & example   \\\hline\\
\textcolor{green}{green, citecolor}& \cite{cite} \\\\
\textcolor{cyan}{cyan, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{magenta}{magenta, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{cyan}{cyan, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\
\textcolor{green}{green, citebordercolor}& \cite{cite} \\\\
\textcolor{teal}{teal, filebordercolor} & \href{example-image.pdf}{file}\\\\
\textcolor[rgb]{0,1,1}{rgb 0,1,1, urlbordercolor}& \url{https://www.latex-project.org/}\\\\
\textcolor[rgb]{0,0.7,0.7}{rgb 0,0.7,0.7, runbordercolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\begin{thebibliography}{99}
\bibitem{cite} some text
\end{thebibliography}
\end{document}


I like Phelypes suggestions. Just wanted to add some that we have used for a few books (that are also available as PDF files). We always use the colorlinks option and does not differentiate between file and url.

They are either different colors or darker versions of the default, mainly chosen such that they do not disturb the reading experince.

\documentclass{article}
\usepackage{xcolor}

%setup new colors
\hypersetup{
citecolor={[rgb]{0,0.6,0.2}},
filecolor={[rgb]{0.8,0,0.8}},
urlcolor={[rgb]{0.8,0,0.8}},
runcolor={[rgb]{0.8,0,0.8}},  % defaults to filecolor but it missing an
% expansion for this syntax
menucolor={[rgb]{0,0.2,0.6}}, % I never set or use this, so we'll see
citebordercolor={[rgb]{0,0.6,0.2}},
filebordercolor={[rgb]{0.8,0,0.8}},
urlbordercolor={[rgb]{0.8,0,0.8}},
runbordercolor={[rgb]{0.8,0,0.8}},
}
\begin{document}

\begin{tabular}{lll}
default color               & example   \\\hline\\
\textcolor{green}{green, citecolor}& \cite{cite} \\\\
\textcolor{cyan}{cyan, filecolor} & \href{example-image.pdf}{file}\\\\
\textcolor{magenta}{magenta, urlcolor}& \url{https://www.latex-project.org/}\\\\
\textcolor{cyan}{cyan, runcolor}  &  \href{run:sumatra}{run something}
\end{tabular}

\section{hyperref colors / border }
\makeatletter\def\@pdfborder{1 1 1} \def\HyColor@UseColor#1{}\makeatother

\begin{tabular}{lll}
default color                    & example   \\\hline\\