# Beamer, tcolorbox, and fade overlay

I have the code below for uncovering of two tcolorbox'es:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\setbeamercovered{transparent}
\usepackage{tcolorbox}

\begin{document}
\beamerdefaultoverlayspecification{<+->}
\begin{frame}{Test}
\tcbox[size=fbox,nobeforeafter,tcbox raise base]{test1}
\pause
\tcbox[size=fbox,nobeforeafter,tcbox raise base]{test2}
\end{frame}
\end{document}


It works for the frames, but not for the interior text (it is always black), as shown in the screenshots below. How do I make overlay apply to the text as well?

Thanks! Marco

• Welcome to TeX.Stackexchange! – user36296 Jan 3 '18 at 15:40
• Off-topic, but you don't need graphicx with beamer, as beamer already provides this functionality. – user36296 Jan 3 '18 at 15:50

You can use before upper={\pause} to get the desired result. If this should be automatic for all tcolorboxes, you could put it in \tcbset{}.

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setbeamercovered{transparent}
\usepackage[most]{tcolorbox}

\tcbset{%
enhanced,
size=fbox,
nobeforeafter,
tcbox raise base,
}

\begin{document}
\beamerdefaultoverlayspecification{<+->}
\begin{frame}{Test}
\tcbox{test1}
\tcbox[before upper={\pause}]{test2}
\end{frame}
\end{document}


Or if you are looking for something to match the surrounding "overlay" state (based on the unfortunately deleted answer https://tex.stackexchange.com/a/408650/36296):

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setbeamercovered{transparent}
\usepackage[most]{tcolorbox}

\tcbset{%
enhanced,
size=fbox,
nobeforeafter,
tcbox raise base,
}

\begin{document}
\beamerdefaultoverlayspecification{<+->}
\begin{frame}{Test}
\begin{itemize}
\item tes
\item test \tcbox[only=<-.(-1)>{opacitytext=0.2}]{test1} test
\item test \tcbox[only=<-.(-1)>{opacitytext=0.2}]{test2} test
\end{itemize}

\end{frame}
\end{document}


You can store the outer color at the begin of the box and reinsert (sadly not with coltext). Be aware that this will pick up not only the opacity (this could probably be avoided but the code for color mixins is complicated and I never really understood it).

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\setbeamercovered{transparent}
\usepackage[most]{tcolorbox}

\begin{document}
\beamerdefaultoverlayspecification{<+->}
\begin{frame}{Test}
\color{red}\ttfamily
test
\tcbox[size=fbox,nobeforeafter,
tcbox raise base,
code=\colorlet{outercolor}{.},
before upper={\color{outercolor}},
]{test1}
\pause
test
\tcbox[size=fbox,nobeforeafter,
tcbox raise base,
code=\colorlet{outercolor}{.},
before upper={\color{outercolor}},
]{test2}
\end{frame}
\end{document}