I have three items in a beamer slide. They appear one after the other when I press next. My problem is I want the first two items to change color when the third item appears. Please explain how to do this.
2 Answers
No need to write everything twice, you can simply use \only<>{}
to change the colour
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{itemize}[<+->]
\item \only<3>{\color{red}}1
\item \only<3>{\color{red}}2
\item 3
\end{itemize}
\end{frame}
\end{document}
To address the command about dvipsnames
Since beamer
internally already loads the xcolor
package you can pass the dvipsnames
like this:
\documentclass[xcolor=dvipsnames]{beamer}
\begin{document}
\begin{frame}
\begin{itemize}[<+->]
\item \only<3>{\color{Peach}}1
\item \only<3>{\color{Peach}}2
\item 3
\end{itemize}
\end{frame}
\end{document}
-
Thanks a lot, could you please explain how to chose some other color than red? may be RGB or a list of accepted colors? I used \usepackage[dvipsnames]{xcolor} and color Peach, but got errors ): Error: LaTeX Error: Option clash for package xcolor. Error: Package xcolor Error: Undefined color `Peach'– MLTCommented Jun 6, 2014 at 18:53
-
Probably there is a more elegant solution but this one works.
\documentclass{beamer}
\begin{document}
\begin{frame}
\only<1,2>{
\begin{itemize}[<+->]
\item 1
\item 2
\item
\end{itemize}
}
\only<3->{
\begin{itemize}
\uncover<3->{\item \textcolor{red}{1}}
\uncover<3->{\item \textcolor{blue}{2}}
\uncover<3->{\item 3}
\end{itemize}
}
\end{frame}
\end{document}