# How to discolor *ONE* particular link/citation in hyperref?

After reading the hyperref documentation, I have set several coloring options to hyperref using:

\usepackage[colorlinks,
citecolor={blue!50!black},
urlcolor={blue!50!black}]{hyperref}


All links, references are colored now as expected.

The problem is that I also find some of the colored places are undesirable. I either want to remove the color or color it differently.

For example, the title page, where carefully designed rest of the colors get disturbed by few email addresses that I do want to link within.

Note that I want to keep links, but only color/discolor them against the rest of the links. Is there a way to do it?

I guess any solution should work which is capable of force coloring/discoloring a particular text element, overriding the formats/colors that are going to be applied on a global scale later on.

From the answers available at hyperref changing the linkcolor locally in the toc and disable colorlinks locally or just for the toc, here is the more specific answer by myself the OP.

Hopefully it is more comprehensible and reachable than the ones above. (especially for the questions being ToC-specific, which could have been the reason why I didn't find in the first place)

The main take-away is that \hypersetup{}, which is for setting any option of the package hyperref outside \usepackage[..]{hyperref} call, works not only globally within the header, but also locally within the main body of text. So surrounded with braces, it applies those options to any block of text.

Accordingly the specific solution to coloring problem is to use something as below.

For discoloring:

{\hypersetup{hidelinks}<TEXT-OF-INTEREST>}


For coloring differently:

{\hypersetup{allcolors=<COLOR-OF-UR-WISH>}<TEXT-OF-INTEREST>}


Some examples with emails, URL-with-anchor, URLs, citations, references, an entire Table-of-contents, or an entire section respectively:

<TEXT-OF-INTEREST>  =  \href{mailto:xxxx@xyz.com}{xxxx@xyz.com}
<TEXT-OF-INTEREST>  =  \href{www.URL.com}{anchor-text}
<TEXT-OF-INTEREST>  =  \url{www.URL.com}
<TEXT-OF-INTEREST>  =  \cite{XYZ}
<TEXT-OF-INTEREST>  =  \ref{XYZ}
<TEXT-OF-INTEREST>  =  \tableofcontents
<TEXT-OF-INTEREST>  =  \section{....} ....... block of text .....


Thanks to @Torbjørn T.

If needed often, or not, you may prefer to use it as a user-command.

For discoloring:

\newcommand{\discolorlinks}[1]{{\hypersetup{hidelinks}#1}}


Usage: \discolorlinks{<TEXT-OF-INTEREST>}

For coloring differently:

The most general one (as a copy of \textcolor syntax) in the context of forcing a specific color on all links/urls/citations within a block of text (may customize more as you need with options such as citecolor, urlcolor,linkcolor):

\newcommand{\colorlinks}[2]{{\hypersetup{allcolors=#1}#2}}


Example usage: \colorlinks{red}{<TEXT-OF-INTEREST>}