96

I'm using the hyperref package with the option colorlinks=true. However, I'm not happy with the default link colours: for instance, citation links appear in a flamboyantly bright green that hurts my eyes, and presumably, will hurt my readers'.

I know how to change the link colours; that is not the issue. What I want to know is whether there is some consensus as to which colours one should use for

  1. internal links,
  2. TOC links,
  3. citation links,
  4. file links,
  5. URL links.

Supposedly, pure blue (#0000FF in hex) is a widely accepted colour for URL links; but what are "good", standard colours for the other types of links?

Please do not hesitate to chime in.

2
  • 10
    IMHO, a fair trade-off between standard blue for links and something eye friendly and beautiful, is NavyBlue from xcolor.
    – Pouya
    Commented Mar 5, 2013 at 13:06
  • @Pouya how do you do that?
    – Lukas
    Commented Oct 16, 2019 at 9:43

3 Answers 3

48
+50

There are two main purposes for using colored text in documents: style (make the document look more visually pleasing or adequate to its context) and readability (help the reader to understand its meaning). For hyperlink colors, one also has to distinguish between digital and printed documents: the special meaning only makes sense in digital.

Regarding style, less is usually more. Documents that use a coherent and clear color scheme, based on one or two main colors, just look nicer and more professional. It is also easier to align one or two extra colors with some corporate style to match the occasion. I would therefore not suggest to use different colors for different link types.

Regarding readability, blue-ish colors seem to say "link" for most people. Yet, I think that consistently used (dark) green or (dark) red would also convey the message that there is "something special" there. You can see the same color pattern on web sites: most use some form of blue, but others have their own style. For most documents, hyperlinks are an optional feature, so there is no big loss in readability for readers who do not understand the color. If hyperlinks are consistently used for certain keywords, then the document might still make sense in print, i.e., it should not be confusing to readers why some text is in color (or shade of gray if printed monochrome).

I do not think that the reader usually is interested in the distinction between link types, other than for internal link (to document) vs. external link (to some URL). It makes sense to distinguish this, but for all documents that are also meant for printing, one has to include the URL for external links anyway, which should be clear enough to understand that the link is external.

Regarding choice of colors in general, I suggest to avoid "pure" colors like #0000FF. They look too glaring (and also have disadvantages when using projectors, which sometimes are "weak" on one color). Look at this very website to get better examples: the link color I see is #145680. I find the named color MidnightBlue from the xcolor package to be an acceptable choice in LaTeX, which I prefer over NavyBlue. Also, keep in mind that the color should have sufficient darkness: light colors often appear to have more style, but are harder to read in print – the infamous devil's CSS #666 is used for text on many "stylish" websites. The same goes for some versions of blue that you might consider, especially when printed in black and white.

2
  • 1
    I would personally never give colored links to a B&W printer to get grayish text, I would code a print version in that removes all link coloring so all text is just black and links are marked by a different font.
    – lblb
    Commented Apr 2, 2017 at 17:35
  • @lblb why is this worth the effort? I.e. what is the compelling reason you need a distinct print version, or how comes this is so easy that it is not much effort at all?
    – lucidbrot
    Commented Sep 15, 2020 at 8:19
64

Following the advice of Robin Williams, author of The Non-Designer's Design Book,

A set of three colors equidistant from each other always creates a triad of pleasing colors.

I have found that using colours equally distributed around the colour wheel works well. For the links in my example below, I use three colours that form a triad: yellow-orange, aquamarine, and violet.

enter image description here

enter image description here

\documentclass{article}

\usepackage{lipsum}
\usepackage{filecontents}
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage{cleveref}

\newcommand\myshade{85}
\colorlet{mylinkcolor}{violet}
\colorlet{mycitecolor}{YellowOrange}
\colorlet{myurlcolor}{Aquamarine}

\hypersetup{
  linkcolor  = mylinkcolor!\myshade!black,
  citecolor  = mycitecolor!\myshade!black,
  urlcolor   = myurlcolor!\myshade!black,
  colorlinks = true,
}

\bibliographystyle{alpha}

\begin{filecontents*}{mybib.bib}
@ARTICLE{bibexample,
   author = {L[eslie] A. Aamport},
   title = {The Gnats and Gnus Document Preparation System},
   journal = {\mbox{G-Animal's} Journal},
   year = 1986,
}
\end{filecontents*}

\begin{document}
\tableofcontents
\section{foo}\label{foosec}
\subsection{bar}\label{barsubsec}
All \TeX{} users, rally around \url{http://tex.stackexchange.com}!
As shown in~\cite{bibexample}, blah blah blah in \cref{barsubsec}.
\bibliography{mybib}
\end{document}
1
  • This AI tool to generate pleasing colour combos may be helpful! colormind.io
    – Anti Earth
    Commented Jan 27, 2022 at 4:00
15

Use blue for any link you want your reader to immediately understand it is a link and do not change colors based on type unless it is black.

The journal articles I read are mainly in solid state physics and come from an IEEE format or one from the AIP. Even with overlapping content the style for hyperlinks is different. If you look at the IEEEtran documentation (IEEEtran HOWTO) you will notice that there are hyperlinks, but all of them are black. In the Journal of Applied Physics equation reference links, citation links, URL links are all in blue. These follow different styles and if your work is trying to write in that style or be read by people who are used to that style I would using existing conventions.

Writing things that are not necessarily following a specific style guide allows you to use whatever you like. I generally use the principle of keeping everything black, maybe using blue if I want to emphasize that links are available. To go beyond this I would require some special circumstances.

I generally feel that additional color in the main body of text is distracting and the reason for coloring the links is to emphasize that it is a link. Changing the color because it is a different type of link is not important because the context the link appears in will already signal the reader as to where the link will take them and the color simply informs the reader they do not have to search for this manually. Blue is used on the internet and in different publications more or less as the default so it is a clear signal to the reader.

Reasons to use a color other than blue would be that the document is part of a more comprehensive site that uses a different color for links and you want to keep consistent. Reasons to use more than one color would be because you use superscripts for references and superscripts for footnotes and want to set them apart more clearly (I would use the same color, but I can see an argument against). Again, if you are trying to emulate existing style you may use multiple or a color different than blue.

The only other reason I would be changing colors in the document would be a specific design choice. This would cause me to both try different things myself and get feedback from others. I may also consult a professional for this case.

2
  • 2
    Hyperref also makes references inside the document into links, not just URLs ans such. There I find different colors work fine (I use urlcolorlinks = blue, will try the NavyBlue suggestion...). De gustibus non est disputandum, said the Romans...
    – vonbrand
    Commented Mar 5, 2013 at 19:21
  • There is no urlcolorlinks option, but only linkcolor and urlcolor.
    – Johannes
    Commented Jun 5, 2023 at 8:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .