42

I would like web links generated by the \href command to be colored in my Beamer presentation. Passing the colorlinks option to hyperref leads to navigation links within the PDF receiving (default, ugly) colors. OTOH, without passing that option hyperref doesn't apply any color to links at all.

\definecolor{links}{HTML}{2A1B81}
\hypersetup{urlcolor=links} % Does not apply color to href's
\hypersetup{colorlinks,urlcolor=links} % href's are correct, but navigation links are magenta

Is there a way to tell hyperref to apply a color only to links generated by \href (or \url), and leave navigation links alone? (I know that I could define a command \myhref to do the color-changing manually; I am looking for a solution that uses the built-in facilities of hyperref/beamer.)

  • 4
    Please add a minimal example that illustrates your problem. For example, your other possibly other hyperref options and specifically (x)color options are not clear here. So it's hard to work out. – Stefan Kottwitz Mar 14 '11 at 18:49
48

You could add \hypersetup{linkcolor=} in order to remove the coloring of internal links used for navigation purposes:

\documentclass{beamer}
\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}
\usetheme{Frankfurt}
\begin{document}
\section{Test}
\begin{frame}
  \url{http://tex.stackexchange.com/}\\
  \href{http://tex.stackexchange.com/questions/13423/how-to-color-href-links-in-beamer}{Your question}
\end{frame}
\end{document}

works fine for me as you can see in the headline - the navigation link is colored in the default gray tone, while the links are colored in the desired blue.

  • 2
    Perfect -- the blank specification of linkcolor was exactly the kind of trick I was looking for. – Aaron Mar 23 '11 at 18:52
  • 2
    It did not work for me. I had to input linkcolor=white. – Wok Nov 29 '12 at 10:38
  • I finally chose linkcolor=gray because of this: tex.stackexchange.com/questions/21696 – Wok Nov 29 '12 at 12:04
  • Dude... thank you so much. This was driving me crazy. Works like a charm. – Luke Davis Feb 20 '18 at 23:46
3

If you're looking for something more simple, here another alternative.

\href{https://www.url.com/}{\color{blue}{\underline{Demo}}}

enter image description here

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.