# Remove the ugly borders and set different colors to hyperlinks using elsarticle template

I am using the elsarticle template to write something. I want to remove the ugly border and use different colors instead. My setting is as follows:

\usepackage[colorlinks=true,linkcolor=red,citecolor=green]{hyperref}


The results is that ugly borders disappear but the all of linkcolor and citecolor are blue despite of no blue setting.

Any suggestion is greatly appreciated.

Class elsarticle also sets the colors:

\AtBeginDocument{\@ifpackageloaded{hyperref}
\def\@anchorcolor{blue}
\def\@citecolor{blue}
\def\@filecolor{blue}
\def\@urlcolor{blue}
\def\@pagecolor{blue}


Therefore your colors should be set at a later time:

\documentclass{elsarticle}

• @user22986: The "first component" is just the code snipset of elsarticle.cls, proving that the class is responsible for the blue color and shows the time, when the colors are set (\AtBeginDocument). – Heiko Oberdiek Jul 20 '13 at 21:57