[Tex/LaTex] How to create a filled colored box in Beamer

beamerboxescolor

I'm creating a presentation with Beamer, and I want to include a text that will be inside a filled colored box. At first I thought creating the filled colored box using TikZ, and I have the following:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{frame}{Test}

\begin{center}
  \begin{tikzpicture}
    \node[preaction={fill=cyan,fill opacity=0.5},rounded corners=1ex,font=\fontsize{12pt}{12pt}\itshape] {This is a \textcolor{blue}{\textbf{very}}, \textcolor{red}{\textbf{long}} and \textcolor{blue}{\textbf{stupid}} \\line of text without purpose};
  \end{tikzpicture}
\end{center}
\end{frame}

\end{document}

The problem is that because my sentence is kind of long, I wanted to put half of in the new line using \\, but it gives me an error. Any idea how to circumvent the problem, or create what I want in another way?

Best Answer

The 'shortest' example to show the basic usage of beamercolorbox.

Please note that there are 'better/nicer' boxes such as beamerboxrounded or tcolorbox package to produce such setup.

\documentclass{beamer}

\usepackage{blindtext}
\begin{document}
\begin{frame}{Foo}
  \setbeamercolor{coloredboxstuff}{fg=yellow,bg=white!10!blue}
  \begin{beamercolorbox}[wd=0.9\textwidth,sep=1em]{coloredboxstuff}
    \blindtext
    \end{beamercolorbox}
\end{frame}
\end{document}

enter image description here