TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

            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.

share|improve this question
To specify colors as RGB byte triplets as in your example, replace rbg with RGB in Geoffrey Jones answer below. E.g. urlcolor = [RGB]{0 128 128}. – ntc2 Jan 27 '14 at 8:49
up vote 20 down vote accepted

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:


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:


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.

share|improve this answer
I wonder why there is no mention of the [rgb] option in texdoc hyperref? Do you happen to know where it is documented? – Kit Oct 25 '10 at 1:09
@Kit, like many things in TeX/LaTeX, the ultimate documentation is the source code itself. I just stuck my nose into hyperref.sty (and child packages that it loads) to figure out how it does things. Classic case of "no pain, no gain", wot? :) – Geoffrey Jones Oct 25 '10 at 6:20
More like slowly but surely for me :) And also, the sooner I accept that source code is the best documentation, the better. And to be able to read source code, I'll need the TeXbook, right? – Kit Oct 25 '10 at 13:27

You must define the name of color first. In the case of Teal it is not necessary as it is defines in svgnam.def, so you can use the svgnames option.

share|improve this answer
I got ! Illegal unit of measure (pt inserted). error for ...{0 128 128} and had to change it to {0,128,128}. Not sure if space separated form is wrong, so not editing the answer. – xaizek Oct 26 '15 at 8:17
@xaizek: I don't get an error with my code (with the color definition activated), imho both syntax (with space and with commas) should work, but commas are the official one, so I edited the code. – Ulrike Fischer Oct 26 '15 at 8:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.