\documentclass{article}
\usepackage{color}
\usepackage{amsmath}
\begin{document}
$b$ B

{\color{red} $r {\color{green} g \color{yellow} y}$ R} B

{\color{red} R $r \mbox{R} {\color{green} g \mbox{G} \color{yellow} y \mbox{Y}} r \mbox{R}$ R} B

{$\color{red} r$ B} B

{\color{red}$\mbox{R} \text{R}$} B

{\color{red}$$ r $$}

$b$ B



\end{document}
