3

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).

  • just use standard color package definition \definecolor{mycolor}... then use mycolor for any of the options – David Carlisle Aug 27 '15 at 19:13
3

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

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

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.