How can I individually set the color of the hyperlinks ? It currently has a red box around it.

\href{www.google.com}{Test}


How can I select its color ? Like

\href{www.google.com}{Test}{boxcolor=blue}


I have many other boxes to put with different colors so Id rather repeatedly type a short idiot-friendly method then redefine the function definitions.

• Reading the manual of hyperref helps: \hypersetup{linkcolor=blue}, for example – user31729 Feb 13 '18 at 15:47
• @ChristianHupfer - But it doesn't help that much. urlcolor is the one you want, but it only works with colorlinks=true. I think the box colors are chosen by the PDF viewer. – John Kormylo Feb 13 '18 at 17:32
• @JohnKormylo: True, I missed that it is about urls – user31729 Feb 13 '18 at 17:35
• \usepackage[colorlinks,urlcolor=orange]{hyperref} to avoid the ugly boxes and fix a default organge color for URL links, and then \href{http://www.example.com}{\color{blue}www.example.com} to make a individual link in blue. – Fran Feb 13 '18 at 22:08

You can use {\color{<color>}\url{<url>}} or \href{<url>}{\color{<color>}<text>}. A macro could simplify only a little this:

\documentclass{article}
\usepackage{xcolor}
\newcommand\colorurl[2]{{\color{#1}\url{#2}}}

\begin{document}

\obeylines

\href{http://www.example.com}{www.example.com}

\bigskip

\url{http://www.example.com}
\colorurl{purple}{http://www.example.com}
\colorurl{violet}{http://www.example.com}
\colorurl{blue}{http://www.example.com}

\end{document}


In the odd case that you want link boxes instead of colored text, remove any package option incompatible with that boxes (e.g. colorlinks or hidelinks) and then use some like:

\hypersetup{urlbordercolor=orange}
\url{http://www.example.com}