I have an enumerated list, for which I'm using enumitem
because I want to resume the enumeration, and one item is rendered in a faded color using xcolor
\usepakage{enumitem, xcolor}
% ...
\begin{enumerate}
\item First.
\end{enumerate}
other stuff
\begin{enumerate}[resume]
\item Second.
\item \textcolor{gray}{Third.}
\item Fourth.
\end{enumerate}
I'd like to have the label of "Third." rendered in the same faded color, and because I've seen Bolding a single number in a enumerated list I defined
newcommand{\fadeditem}{\item[\stepcounter{enumi}\textcolor{gray}{\arabic{enumi}.}]}
and it works (it's not general, but it works) but now it's not enough… I realize that what I want is a command that takes care also
of the item text
What I have now
\fadeditem \textcolor{gray}{Bla bla bla.}
What I would like
\itemcolor{gray} Bla bla bla.
Addendum #1
David Carlisle, in a comment, suggested
\newcommand\itemcolor[1]{\fadeditem{#1}\textcolor{#1}}
and this deals with my task of today, writing optional questions in a list of questions.
An open part of the question is then a generalization of the problem,
defining an \itemcolor{somecolor}
command that just works in any (in most?) lists…
Best Answer
EDITED to limit the scope of the renewed
\item
to the newly definedcenumerate
environment.More simply without redefining
\item
, but with a little extra typing, just invoke\color
in a group, as needed, to get the same result: