[Tex/LaTex] Change font color of multiple rows in a table

colortables

I found the following post to change the font color of a single row in a table:

How to color the font of a single row in a table?

My row is a long table with 70 rows and for about 25 the I want to change the font color. I was wondering if there is a better way of coloring these 25 rows rather than using \rowfont{\color{red}} 25 times?

Best Answer

enter image description here

\documentclass{article}

\usepackage{color,array}

\makeatletter


\def\zapcolorreset{\let\reset@color\relax\ignorespaces}
\def\colorrows#1{\noalign{\aftergroup\zapcolorreset#1}\ignorespaces}

\makeatother

\begin{document}

\begin{tabular}{ll}
1&2\\
1&2\\
1&2\\\colorrows{\color{red}}
1&2\\
1&2\\
1&2\\\colorrows{\color{black}}
1&2\\
1&2\\
1&2
\end{tabular}
\end{document}