# Undefined color error for URL, when compiling with XeLaTeX

I've defined a different color for hyperlink using \hypersetup command with urlcolor. When I am compiling it with XeLaTeX I am getting undefined color error for the URL link, but it works fine when I compile with LaTeX (the color of the link changes). Similar error have been discussed before here and here, but my problem seems to be a bit different. Below is a simplified example of code I am trying to compile:

\documentclass[10pt, a5paper]{article}
\usepackage{fontspec}
\PassOptionsToPackage{pdftex,usenames,dvipsnames}{color}
\begin{document}
\begin{center}
\href{http://tex.stackexchange.com/}{http://tex.stackexchange.com/}
\end{center}
\end{document}

-
\usepackage[usenames,dvipsnames]{xcolor} instead of the corresponding with color –  egreg Dec 20 '11 at 0:39

You would also receive a host of other errors. Here it is best to use

\usepackage[usenames,dvipsnames]{xcolor}


rather than "passing the options to the package". Since you're processing your file under xelatex anyway, I've dropped the driver support pdftex. By default I use xcolor, although you could also use color.

\documentclass[10pt, a5paper]{article}
\usepackage{fontspec}
\usepackage[usenames,dvipsnames]{xcolor}