8

Extending this wonderfully useful post ("options for appearance of links in hyperref"), I am curious if you might list all the color options (or point me to the appropriate documentation) for linkcolor, citecolor, filecolor, and urlcolor when using the hyperref library?

For this, I see as examples black, gray, blue, green, magenta, and cyan.

I also see that linkbordercolor, citebordercolor and urlbordercolor (which control color options of the frame around links, citations, and borders when colorlinks = false) offer arbitrary color selection (see documentation details)

However I cannot seem to find any way to set arbitrary colors for linkcolor, citecolor, filecolor or urlcolor (e.g. gray50, {0 0 1} or something else).

1
  • just use standard color package definition \definecolor{mycolor}... then use mycolor for any of the options Aug 27, 2015 at 19:13

1 Answer 1

11

Once you load the xcolor package, you have access to all the color specifications this package allows; in particular, you can use the hundredths of predefined colors it provides, to the ! modifier for mixing colors, to the - for complements, etc.; using \definecolor{<name>}{<model>}{<specification>} you can build your own colors in the desired modes and then use <name> in the hyperref setup (please refer to the package documentation for further details).

A little example showing some of the possibilities:

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

\definecolor{mycolor}{HTML}{F7F8E0}
\definecolor{myorange}{RGB}{245,156,74}

\hypersetup{
  colorlinks=true,
  urlcolor=red
}

\begin{document}

\href{www.tex.stackexchange.com}{TeX.sx}

\hypersetup{
  colorlinks=true,
  urlcolor=cyan!50
}
\href{www.tex.stackexchange.com}{TeX.sx}

\hypersetup{
  colorlinks=true,
  urlcolor=ForestGreen% required dvipsnames optioon for xcolor
}
\href{www.tex.stackexchange.com}{TeX.sx}

\hypersetup{
  colorlinks=true,
  urlcolor=myorange
}
\href{www.tex.stackexchange.com}{TeX.sx}

\hypersetup{
  colorlinks=true,
  urlcolor=-myorange
}
\href{www.tex.stackexchange.com}{TeX.sx}

\hypersetup{
  colorlinks=true,
  urlcolor=mycolor!75!black
}
\href{www.tex.stackexchange.com}{TeX.sx}

\end{document}

enter image description here

1
  • Thanks Gonzalo, that certainly did the trick for me. And thanks for letting me know about the package Aug 27, 2015 at 20:28

You must log in to answer this question.

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