I would like showidx to display the entries in the margin in red but can't figure out how, if only because showidx is loaded by the famous Heiko Oberdiek hack. Here is a MWE:
\documentclass[11pt]{book}
\usepackage{xcolor}
\usepackage{makeidx}
\usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}]
\makeatletter
\ifHy@hyperindex
\def\HyInd@ParenLeft{(}%Hook in \HyInd@@wrindex
\let\HyInd@showidx\@empty%Hook in \HyInd@@wrindex for package showidx
\def\HyInd@showidx#1{%
\@showidx{#1}%
\if@nobreak
\ifvmode
\nobrak
\fi
\fi
}%
\let\siOrg@makeindex\makeindex
\let\siOrg@@index\@index
\let\siOrg@@wrindex\@wrindex
\let\siOrg@index\index
\RequirePackage{showidx}
\let\makeindex\siOrg@makeindex
\let\@index\siOrg@@index
\let\@wrindex\siOrg@@wrindex
\let\index\siOrg@index
% rest of hyperref part
\@ifpackageloaded{multind}{%
\let\HyInd@org@wrindex\@wrindex
\def\@wrindex#1#2{\HyInd@@wrindex{#1}#2||\\}%
\def\HyInd@@wrindex#1#2|#3|#4\\{%
\ifx\\#3\\%
\HyInd@org@wrindex{#1}{#2|hyperpage}%
\else
\def\Hy@temp@A{#3}%
\ifx\Hy@temp@A\HyInd@ParenLeft
HyInd@org@wrindex{#1}{#2|#3hyperpage}%
\else
\HyInd@org@wrindex{#1}{#2|#3}%
\fi
\fi
}%
}{%
\def\@wrindex#1{\@@wrindex#1||\\}
\def\@@wrindex#1|#2|#3\\{%
\ifx\\#2\\%
\protected@write\@indexfile{}{%
\string\indexentry{#1|hyperpage}{\thepage}%
}%
\else
\def\Hy@temp@A{#2}%
\ifx\Hy@temp@A\HyInd@ParenLeft
\protected@write\@indexfile{}{%
\string\indexentry{#1|#2hyperpage}{\thepage}%
}%
\else
\protected@write\@indexfile{}{%
\string\indexentry{#1|#2}{\thepage}%
}%
\fi
\fi
\endgroup
\HyInd@showidx{#1}%
\@esphack
}%
}%
\fi
\makeatother
\hypersetup{%begin colors
colorlinks,
linkcolor={red!50!black},
citecolor={blue!50!black},
urlcolor={blue!80!black}
}%end colors
\newcommand{\INDEX}[2][]{\phantomsection%
\if\relax\detokenize{#1}\relax\index{#2}\label{ind:#2}%
\else\index{#2}\label{ind:#1}\fi%
}%
\newcommand{\DEX}[2][]{%
\if\relax\detokenize{#1}\relax\hyperref[ind:#2]{#2}%
\else\hyperref[ind:#1]{#2}%
\fi%
}%
\makeindex
\begin{document}
I would like this \textbf{NewWord}\INDEX[]{NewWord} to appear in the Index in black but be displayed in the margin in \textcolor{red}{red}.
\newpage
Just for checking, clicking on \DEX[NewWord]{\emph{NewWord}} should get us back to its first appearance.
\printindex
\end{document}