Several posts describe the coloration of single items (text and item label); however, these solutions do not work in beamer
documents. For instance, following this post, expected results are obtained for articles but not beamer frames:
article:
\documentclass{article}
\usepackage{xcolor}
\newcommand\itemcolor[2]{%
\begingroup%
\color{#1}%
\item #2%
\endgroup}
\begin{document}
\begin{enumerate}
\item first
\itemcolor{red}{second}
\item third
\begingroup
\color{red}
\item fourth
\endgroup
\item fifth
\end{enumerate}
\end{document}
beamer:
\documentclass{beamer}
\usepackage{xcolor}
\setbeamercolor{structure}{fg=black}
\newcommand\itemcolor[2]{%
\begingroup%
\color{#1}%
\item #2%
\endgroup}
\begin{document}
\begin{frame}
\begin{enumerate}
\item first
\itemcolor{red}{second}
\item third
\begingroup
\color{red}
\item fourth
\endgroup
\item fifth
\end{enumerate}
\end{frame}
\end{document}
Note that \setbeamercolor{structure}{fg=black}
was used to avoid having the default purple color for the item number, but the effect is the same if that line is omitted (the color of the item number being uniformly purple instead of the designated color).
How can the result for \documentclass{article}
be realized for \documentclass{beamer}
(i.e., coloration of the item label in addition to the item text)? And what is the reason for the discrepancy in behavior between the two document classes?
\usepackage{xcolor}
in your presentation, beamer already load this for you.