# Changing appearance of hyperlinks locally

The code below is borrowed from this post. Sol #1: I expected foo to be highlighted, it isn't. Since I want the change to be local anyway, how would I restore the defaults?

\documentclass[oneside,fontsize=12pt]{scrbook}
\usepackage{fontawesome}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{hyperref}

%\usepackage{hyperref}

\NewDocumentCommand{\thisshare}{}{\thisfbshare\thistwshare}

\begin{document}

% SOL # 1
\hypersetup{
urlcolor     = blue, %Colour for external hyperlinks
linkcolor    = blue, %Colour of internal links
citecolor   = red %Colour of citations
}

% SOL # 2
%\hypersetup{
%    pdfborder={0 0 0},
%}

{\large Don't forget to share on \thisshare~for \href{http://foo.com}{foo}}

%HOW TO RESTORE?

\end{document}


PS: the surrounding boxes for FB and Tw would be just fine if they didn't overlap with each other.

The colorlinks option must be set in the preamble.

\documentclass[oneside,fontsize=12pt]{scrbook}
\usepackage{fontawesome}
\usepackage{xparse}
\usepackage{hyperref}

\NewDocumentCommand{\thisshare}{}{\thisfbshare\thistwshare}

\begin{document}

{\large Don't forget to share on \thisshare~for \href{http://foo.com}{foo}}

\hypersetup{
urlcolor     = blue, %Colour for external hyperlinks
linkcolor    = blue, %Colour of internal links
citecolor   = red %Colour of citations
}

{\large Don't forget to share on \thisshare~for \href{http://foo.com}{foo}}

\hypersetup{allcolors=black,pdfborder=0 0 1}

{\large Don't forget to share on \thisshare~for \href{http://foo.com}{foo}}

\end{document}


• Just one problem: calls to \gls within body of text get highlighted. See setup here. I guess this is the answer? – Erwann Sep 21 '19 at 1:03
• Related question, how to retrieved hypersetup parameters, such as urlcolor? – Erwann Sep 23 '19 at 23:38
• Don't ask new questions in comments. That pings only one person. Ask a new question. – Ulrike Fischer Sep 24 '19 at 6:06