Link formatting: colors, underlines in moderncv

That is because moderncv.cls sets pdfborder to 0 0 0 at the beginning of the document; here's the relevant code:

\AtEndPreamble{
  \@ifpackageloaded{CJK}
    {\RequirePackage[CJKbookmarks]{hyperref}}
    {\RequirePackage[pdftex]{hyperref}}
  \AtBeginDocument{
    \hypersetup{
      breaklinks,
      baseurl       = http://,
      pdfborder     = 0 0 0,
      pdfpagemode   = UseNone,% do not show thumbnails or bookmarks on opening
%      pdfstartview  = FitH,
      pdfstartpage  = 1,
      pdfcreator    = \LaTeX{} with `moderncv' package,
      pdfproducer   = \LaTeX{},
      bookmarksopen = true,
      pdfauthor     = \@firstname~\@familyname,
      pdftitle      = \@title,
      pdfsubject    = \@firstname~\@familyname,
      pdfkeywords   = \@firstname~\@familyname{} curriculum vit\ae{}}}
  \pagenumbering{arabic}% has to be issued after loading hyperref
}

EDIT: now I understand the request a little bit better (I hope); initially I thought that all the urls should have a colored border and I proposed some solution, now I see that it's just about some urls being colored. Taking this into account, I offer another solution:

I defined a new command \Colorhref with one optional argument (the color for the urls, default=cyan) and two mandatory arguments that will be passed to the standard \href command (\Colorhref also takes care of the change in font size). In your document you can use \Colorhref if you want your url with color and \href otherwise. Use the standard moderncv class:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{casual}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\firstname{Adam}
\familyname{Matan}
\email{[email protected]}
\homepage{www.matan.name}

\newcommand\Colorhref[3][cyan]{\href{#2}{\small\color{#1}#3}}

\begin{document}
\maketitle
\section{Professional network}

\cvline{Linkedin.com}        {\Colorhref{http://www.linkedin.com/in/adamatan}             {Adam Matan}   - Professional profile and links.    }
\cvline{Stackoverflow.com}   {\small\href{http://stackoverflow.com/users/51197/adam-matan} {Adam Matan}   - My software questions and answers. } 
\cvline{twitter.com}         {\Colorhref[red]{http://twitter.com/justnoticed}{@justnoticed} - My tech tweets.}

\end{document}

Here's the result of the compilation of the above example code:


moderncv does its hyperref setup at the beginning of the document (because only there can it use personal information such as \firstname), so the most elegant solution in my opinion is to do the same, e.g.

\AtBeginDocument{\hypersetup{pdfborder = 0 0 1,linkcolor=blue}}

That way, there is no need to define custom commands.


Goodness, the other answers are way too long or complicated.

The OP answered his own question in a comment (and it was the solution I was looking for). You can just change the properties of the text, which seems super obvious now that I think about it. Here is how you can color the link:

\textcolor{cyan}{\href{http://www.wikibooks.org}{wikibooks home}}

enter image description here

Similarly, you can underline the text using:

\underline{\href{http://www.wikibooks.org}{wikibooks home}}

enter image description here

The other answers are fine, but I'm just providing the simplest solution that resolved my problem.