General ⇒ BEAMER colorbox environment with colors as arguments
BEAMER colorbox environment with colors as arguments
\documentclass[xcolor=svgnames]{beamer}
\usetheme{PaloAlto}
\usepackage[ansinew]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{fancybox}
\setbeamercolor{upcol}{fg=black,bg=yellow}
\setbeamercolor{lowcol}{fg=black,bg=yellow!40}
\newenvironment{colorblock}
{
\begin{beamerboxesrounded}[upper=upcol,lower=lowcol,shadow=true]}
{\end{beamerboxesrounded}}
\begin{document}
\begin{frame}
\begin{colorblock}{Title}
Text.
\end{colorblock}
\end{frame}
\end{document}
SO WORKS, BUT WITH THE ARGUMENTS IT DOES NOT WORK. -->
\documentclass[xcolor=svgnames]{beamer}
\usetheme{PaloAlto}
\usepackage[ansinew]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{fancybox}
\setbeamercolor{upcol}{fg=black,bg=yellow}
\setbeamercolor{lowcol}{fg=black,bg=yellow!40}
\newenvironment{colorblock}[2]
{
\begin{beamerboxesrounded}[upper=#1,lower=#2,shadow=true]}
{\end{beamerboxesrounded}}
\begin{document}
\begin{frame}
\begin{colorblock}[upcol,lowcol]{Title}
Text.
\end{colorblock}
\end{frame}
\end{document}
COULD SOMEBODY HELP ME ON THAT MATTER?
THANK YOU.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
BEAMER colorbox environment with colors as arguments
Code: Select all
\begin{colorblock}{upcol}{lowcol}
Re: BEAMER colorbox environment with colors as arguments
A solution is to write this line \setbeamercolor{item}{fg=yellow,bg=yellow}, but then each item of each colorblock will be yellow, and not of the background color of the correspondly own colorbox.
\documentclass[xcolor=svgnames]{beamer}
\usetheme{PaloAlto}
\usepackage[ansinew]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{fancybox}
%
\setbeamercolor{yellow}{fg=black,bg=yellow}
\setbeamercolor{lightyellow}{fg=black,bg=yellow!40}
\setbeamercolor{block title alerted}{fg=black}
\newenvironment{colorblock}[2]
{
\begin{beamerboxesrounded}[upper=#1,lower=#2,shadow=true]}
{\end{beamerboxesrounded}}
\begin{document}
\begin{frame}
\begin{colorblock}{yellow}{lightyellow}{Title}
\begin{itemize}
\item First
\end{itemize}
\end{colorblock}
\begin{alertblock}{Title}
\begin{itemize}
\item First
\end{itemize}
\end{alertblock}
\end{frame}
\end{document}
DO YOU HAVE A SOLUTION???
Re: BEAMER colorbox environment with colors as arguments
\documentclass[xcolor=svgnames]{beamer}
\usetheme{PaloAlto}
\usepackage[ansinew]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{fancybox}
%
\setbeamercolor{yellow}{fg=black,bg=yellow}
\setbeamercolor{lightyellow}{fg=black,bg=yellow!40}
\setbeamercolor{orange}{fg=black,bg=orange}
\setbeamercolor{lightorange}{fg=black,bg=orange!40}
%\setbeamercolor{item}{fg=yellow,bg=yellow}
\newenvironment{colorblock}[2]
{\setbeamercolor{item}{fg=#1,bg=#1}\begin{beamerboxesrounded}[upper=#1,lower=#2,shadow=true]}
{\end{beamerboxesrounded}}
\begin{document}
\begin{frame}
\begin{colorblock}{yellow}{lightyellow}{Title}
\begin{itemize}
\item First
\end{itemize}
\end{colorblock}
\begin{colorblock}{orange}{lightorange}{Title}
\begin{itemize}
\item First
\end{itemize}
\end{colorblock}
\end{frame}
\end{document}