This post asks for an extension of Werner's answer given in Color an example-image.
Consider the following code:
\documentclass{article}
\usepackage{xcolor,graphicx}
\usepackage{caption}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\makeatletter
\define@key{Gin}{color}{\def\Gin@color{#1}}
\setlength{\fboxsep}{0pt}
\let\oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{%
\ifnum\pdfstrcmp{#2}{example-image}=0%
\begingroup
\setkeys{Gin}{color=red,#1} % Sets default color to be red
\colorbox{\Gin@color}{\phantom{\oldincludegraphics[#1]{#2}}}%
\endgroup
\else
\oldincludegraphics[#1]{#2}%
\fi
}
\makeatother
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\begin{document}
\begin{figure}[!htb]
\centering
\includegraphics[width=20em,height=30em]{example-image}
\captionsetup{labelformat=empty} \vskip 8pt
\caption{\textbf{\scshape{\large (Default Red) Figure}}}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=20em,height=30em,color=blue]{example-image}
\captionsetup{labelformat=empty} \vskip 8pt
\caption{\textbf{\scshape{\large (Specified) Blue Figure}}}
\end{figure}
\end{document}
which produces the two figures:
QUESTION: Is it possible to modify the macro so that the original example-image appears if no color is specified to produce the figure? If so, how? The macro currently defaults the color of the example-image to be "red" if no specific color is indicated in producing the example-image.
Thank you.



\begin{figure}\end{figure}specifications, but the original "drab" color of the defaultgraphicximage when no specific color is specified. – DDS Jan 24 '22 at 19:22color=.. – Peter Grill Jan 24 '22 at 20:32\includegraphics[width=20em,height=30em,color=]{example-image}for the first figure, it produced an error. – DDS Jan 24 '22 at 21:51color=, butcolor=.(note the "."). – Peter Grill Jan 24 '22 at 22:52\includegraphics[width=20em,height=30em,color=.]{example-image}; thank you. However, it produces a solid black image. – DDS Jan 24 '22 at 23:12