# different color shading for each theorem type

There are lots of comments around the Internet about how to colorize theorems in LaTeX, and many are beyond my grasp in complexity.

For the moment, I'm using a fairly simple pattern which lets me colorize theorems, lemmas etc, but all in the same color. Can this pattern be easily extended to allow lemma, corollary, definition, example, etc to all have their own color? E.g., lemmas in light blue, theorems in light pink etc. The code is given below.

I don't really understand in depth why this works, but it seems all the shaded environments use the same global value of shadecolor. If I could locally define a different value of shadecolor in each \newenvironment that might have a hope of working. 1) I don't know whether that concept even makes sense, 2) I don't know the syntax.

\documentclass[a4paper]{article}

\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{framed}
\theoremstyle{plain}% default
\newtheorem{prototheorem}{Theorem}[section]

\newenvironment{theorem}

\newtheorem{protolemma}[prototheorem]{Lemma}
\newenvironment{lemma}

\newtheorem{protocorollary}[prototheorem]{Corollary}
\newenvironment{corollary}

\theoremstyle{definition}
\newtheorem{protonotation}{Notation}[section]
\newenvironment{notation}

\newtheorem{protoexample}{Example}[section]
\newenvironment{example}

\newtheorem{protodefinition}{Definition}[section]
\newenvironment{definition}

\newcommand{\powerset}[1]{\rho(#1)}

\begin{document}

\section{Introduction}

\begin{theorem}
\label{theorem.188}  %% used
If $V \subseteq U$, and if $F$ is a set of binary functions defined on
$U$, then there exists a unique $clos_F(V)$ and it is closed under $F$.
\end{theorem}
\begin{proof}
First we show, by construction, that at least one closed superset of $V$ exists.
Define a sequence $\{\Phi_n\}_{n=0}^{\infty}$ of sets as follows:
\begin{itemize}
\item $\Phi_0 = V$
\item If $i>0$, then $\Phi_{i} = \Phi_{i-1} \cup \bigcup\limits_{f \in F}\{f(x,y) \mid x,y\in \Phi_{i-1}\}$
\end{itemize}
Define the set $\Phi = \bigcup\limits_{i=0}^{\infty}\Phi_i$. We know
that $V = \Phi_0 \subseteq \bigcup\limits_{i=0}^{\infty}\Phi_i$.  Next,
let $\alpha \in \Phi$, $\beta \in \Phi$, $f \in F$; take $n \geq 0$
such that $\alpha,\beta \in \Phi_n$.  By definition
$f(\alpha,\beta) \in \Phi_{n+1} \subseteq \Phi$.  Thus $\Phi$ closed under $F$.
\end{proof}

\begin{example} \label{example.363}
Let $V= \{\{1,2\},\{2,3\}\}$, and $F$ but the set containing the
set-union and set-intersection operations, denoted
$F=\{\cup,\cap\}$.  Then $clos_F(V) = \{\emptyset,\{1,2\},\{2\},\{2,3\},\{1,2,3\}\}$, because if we take $\alpha, \beta \in \{\emptyset,\{1,2\},\{2\},\{2,3\},\{1,2,3\}\}$ then both $\alpha \cup \beta$ and $\alpha \cap \beta$ are also therein.

\end{example}

\begin{definition}
\label{def.vhat}
If $V\subseteq U$, and $F$ is the set of three primitive set operations
union, intersection, and relative complement, ($F = \{\cup, \cap, \setminus \}$) then we denote
$clos_F(V)$ simply by $\sigma(V)$ and call it the \emph{Sigma algebra} of $V$.  Moreover,
each element of $\sigma(V)$ is called a \emph{Boolean combination} of elements of $V$.
\end{definition}

\section{Conclusion}

\begin{corollary}
\label{corol.467}
If $V\subseteq U$, $\sigma(V)$ exists and is unique.
\end{corollary}
\begin{proof}
Simple application of Theorem~\ref{theorem.188}.
\end{proof}
\begin{example}
Let  $V= \{\{1,2\},\{2,3\}\}$ as in Example~\ref{example.363}.\\
$\sigma(V)= \{\emptyset,\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\},\{1,2,3\}\}$.
$\sigma(V)= \powerset{\{1,2,3\}}$.
\end{example}
\end{document}


Just include \colorlet{shadecolor}{orange!15} in the definition of your different environments, only using the respective colors. In detail:

• Old code:

\colorlet{shadecolor}{orange!15} % global definition
\newenvironment{lemma}

• New code:

\newenvironment{lemma}


Full example:

\documentclass[a4paper]{article}

\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{framed}
\theoremstyle{plain}% default
\newtheorem{prototheorem}{Theorem}[section]

\newenvironment{theorem}

\newtheorem{protolemma}[prototheorem]{Lemma}
\newenvironment{lemma}

\newtheorem{protocorollary}[prototheorem]{Corollary}
\newenvironment{corollary}

\theoremstyle{definition}
\newtheorem{protonotation}{Notation}[section]
\newenvironment{notation}

\newtheorem{protoexample}{Example}[section]
\newenvironment{example}

\newtheorem{protodefinition}{Definition}[section]
\newenvironment{definition}

\newcommand{\powerset}[1]{\rho(#1)}

\begin{document}

\section{Introduction}

\begin{theorem}
\label{theorem.188}  %% used
If $V \subseteq U$, and if $F$ is a set of binary functions defined on
$U$, then there exists a unique $clos_F(V)$ and it is closed under $F$.
\end{theorem}
\begin{example} \label{example.363}
Let $V= \{\{1,2\},\{2,3\}\}$, and $F$ but the set containing the
set-union and set-intersection operations, denoted
$F=\{\cup,\cap\}$.  Then $clos_F(V) = \{\emptyset,\{1,2\},\{2\},\{2,3\},\{1,2,3\}\}$, because if we take $\alpha, \beta \in \{\emptyset,\{1,2\},\{2\},\{2,3\},\{1,2,3\}\}$ then both $\alpha \cup \beta$ and $\alpha \cap \beta$ are also therein.
\end{example}
\begin{lemma}
\label{def.vhat}
If $V\subseteq U$, and $F$ is the set of three primitive set operations
union, intersection, and relative complement, ($F = \{\cup, \cap, \setminus \}$) then we denote
$clos_F(V)$ simply by $\sigma(V)$ and call it the \emph{Sigma algebra} of $V$.  Moreover,
each element of $\sigma(V)$ is called a \emph{Boolean combination} of elements of $V$.
\end{lemma}

\section{Conclusion}

\begin{corollary}
\label{corol.467}
If $V\subseteq U$, $\sigma(V)$ exists and is unique.
\end{corollary}
\begin{definition}
Let  $V= \{\{1,2\},\{2,3\}\}$ as in Example~\ref{example.363}.\\
$\sigma(V)= \{\emptyset,\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\},\{1,2,3\}\}$.
$\sigma(V)= \powerset{\{1,2,3\}}$.
\end{definition}
\end{document}