[Tex/LaTex] Hyperlink color problem

hyperref

I read some answers on that questions, but it is still not working as expected.
The code says: link yellow, border green : the result is not the one I expect. If I change the colors, the result remains the same.

enter image description here

\documentclass{article}
\usepackage{xcolor,hyperref}

\hypersetup{%
    colorlinks=true,
    linkcolor=yellow,
    linkbordercolor=green,
    pdfborderstyle={/S/U/W 1pt}}

\begin{document}

\href{%
    https://studio.code.org/s/course3/stage/2/puzzle/1}{%
    Labyrinthe}

\end{document}

Best Answer

You need to reset the border style AtBeginDocument:

\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}

\hypersetup{%
    colorlinks=true,
    urlcolor=yellow,
    urlbordercolor=green,
    pdfborder={1 1 1},
    }

\AtBeginDocument{\hypersetup{pdfborderstyle={/S/S/W 1}}}
\begin{document}

\href{%
    https://studio.code.org/s/course3/stage/2/puzzle/1}{%
    Labyrinthe}

\end{document}

enter image description here

Use pdfborderstyle={/S/U/W 1} if you want to underline.

Related Question