# Different colors for \url and \href commands?

Can \url and \href commands' hyperlinks be displayed in two different colors. Actually I'd like to keep the default \href color (blue) while displaying the url command color in a different color, e.g. in green.

The question is motivated by my need to "see" hyperlinks generated by the \url command, with a quick inspection of the pdf file.

\documentclass[11pt]{article}
\usepackage{hyperref}
\pagestyle{empty}

\urlstyle{same}

\begin{document}

\url{https://tex.stackexchange.com/} %% <--- Hyperlink in green

\href{https://tex.stackexchange.com/}{https://tex.stackexchange.com/}

\end{document}


Hope this may helps for you:

\documentclass[11pt]{article}
\pagestyle{empty}

\urlstyle{same}

\DeclareUrlCommand\url{\color{green}}
\begin{document}

\url{https://tex.stackexchange.com/} %% <--- Hyperlink in green

\href{https://tex.stackexchange.com/}{https://tex.stackexchange.com/}

\end{document}


Output

• Hello. If the links are broken to two lines, they aren't right links. Jun 28 at 8:13
• Please use PDFLaTeX, or XeLaTeX, or LuaLaTeX, etc... Jun 28 at 11:27