I have a command that prints an image and will be used inside a certain environment.
First I run a test if the file exists and is a valid image file
(see this question for the definition of \imagetest).
If it is ok then the image is just printed, otherwise I print a box with an informative message.
\newcommand{\musicSFE}[1]{
\imagetest{#1}
{% If it is a valid image do:
\noindent
\includegraphics{#1}
}
{% If it isn't a valid image do:
\bigskip
%TODO: Make the entry in the \listof...s red
\framebox{\colorbox{yellow}
{Image #1 missing}}
\bigskip
}
}
So far it works ok, but I would like to also print the caption red _in the list of ...
What I found is that with
\captionsetup{font={color=red}}
I can change the appearance of the caption, but only that at the current place in the document. If I do
\DeclareCaptionListFormat{mystyle}{\textcolor{red}{#1 #2}}
and then
\captionsetup{listformat=mystyle}
It actually changes the \listof, but only the reference number gets colored.
So the question is:
How can I color the list entry of such a floating environment?
Actually I'd also accept a suitable other way to highlight such an entry
