[Tex/LaTex] How to specify color in RGB using \hypersetup in hyperref

colorhyperref

How do I specify color in RGB using \hypersetup in hyperref?

I know that this is the right way to do it with color names:

\hypersetup{colorlinks,breaklinks,
            urlcolor=Maroon,
            linkcolor=Maroon}

But I want Teal, which hyperref doesn't recognize. I know Teal = {0 128 128} in RGB, but the following code won't compile:

\hypersetup{colorlinks,breaklinks,
            urlcolor={0 128 128},
            linkcolor={0 128 128}}

I have tried it with comma separators, proportional values (e.g. 0 < x < 1), but to no avail. What is the right way to do it? Also mention the correct texdoc that I should read for further info.

Best Answer

If you'd really prefer to specify RGB colours in \hypersetup without loading the (x)color package, you can always type them in directly like this:

\hypersetup{colorlinks,breaklinks,
            urlcolor=[RGB]{0,0.5,0.5},
            linkcolor=[RGB]{0,0.5,0.5}}

Still, as Ulrike mentioned, loading xcolor is usually the more comfortable way to go. Although probably a little overkill for your problem, this is how I generally proceed:

\usepackage[dvipsnames,svgnames,x11names,hyperref]{xcolor}

Note that you can specify multiple colour name spaces so long as you're not too concerned about name clashes (otherwise read the rules about this in the xcolor manual). Since you're loading xcolor to fit in with hyperref, don't forget to include the [hyperref] option as you go.