86

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
  • 9
    IMHO, a fair trade-off between standard blue for links and something eye friendly and beautiful, is NavyBlue from xcolor. – Pouya Mar 5 '13 at 13:06
  • @Pouya how do you do that? – Lukas Oct 16 '19 at 9:43
45
+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 Apr 2 '17 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 Sep 15 '20 at 8:19
56

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}
14

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.

1
  • 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 Mar 5 '13 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
https://tex.stackexchange.com/questions/100905/best-practice-for-hyperref-link-colours
tex.stackexchange.com
crawl=CC-MAIN-2021-10
179724
application/http; msgtype=response
sha1:5PM27Q6QLLV3ZFOBUUOP4LVKYZUZK7H6
<urn:uuid:31ded5dd-3228-4729-8d7f-35af6b1e0333>
2021-03-02T20:55:41Z
151.101.65.69
text/html
sha1:AMXVERSXIAXAJ6GIWFHS6IC2FDR76RDS
<urn:uuid:22c8a241-aceb-43d5-ab11-a49a92c88e15>
https://tex.stackexchange.com/questions/100905/best-practice-for-hyperref-link-colours
response
<urn:uuid:32e9969f-5703-4dad-bac2-2b7a96d016c7>
isPartOf: CC-MAIN-2021-10
publisher: Common Crawl
description: Wide crawl of the web for February/March 2021
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-98.ec2.internal
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/