[Tex/LaTex] How to get aligned equations to have particular color and not equation numbers

aligncolor

I need to have fews equations aligned by =. These equations are to be displayed in particular color but not the equation numbers.

a = {1,2},            (1)
b = {4,8},            (2)

The two equations above appear in particular color (say red) but the equation numbers in paranthesis are to appear in default color. I tried the following code:

\textcolor{red}{
\begin{align}
 a \; & = \; \left\{1,2\right\}, \\
 b \; & = \; \left\{4,8\right\},
\end{align}
}

But this makes equation numbers also appear in red. And, when I use \textcolor inside align block, it generates error.

Can anyone suggest how can I get the desired formatting.

Best Answer

\documentclass{article}
\usepackage{amsmath,xcolor}
\makeatletter
\renewcommand\tagform@[1]{%
   \maketag@@@{\normalcolor\ignorespaces(#1)\unskip\@@italiccorr}}
\makeatother
\begin{document}

{\color{red}
\begin{align}
 a  & =  \left\{1,2\right\}, \\
 b  & =  \left\{4,8\right\},
\end{align}
}

\end{document}

enter image description here