# How to change font color of a row in tabularx?

I have a table and I want a font color of 5th and 6th row be red. What I'm doing right now is changing the color of each cell in these rows, is there any command which can change font color in a row, not just in one cell?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{multirow,tabularx}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{colortbl,hhline}

\begin{document}

\begin{tabularx}{\textwidth}{ |X|X|X| }
\hline
\textbf{Наименование} & \textbf{BBB} & \textbf{ААА} \\ \hline
Теплопостачання припливних систем & 83 044,00 грн. & 67 000 грн \\ \hline
Монтаж , пусканаладка & 64 000,00 грн. & 74885849 грн \\ \hline
\rowcolor{yellow}
ИТОГО: & 1089158,71 грн. & 100000 \\ \hline
\color{red} Отклонение от минимального предложения, грн & \color{red} 0,00 грн. & \color{red} 34000 \\ \hline
\color{red} Отклонение от минимального предложения, \% & \color{red} 0\% & \color{red} 10 \%  \\ \hline
Срок выполнения работ & 3-4 недели & 2 недели \\ \hline
\end{tabularx}
\vspace{1cm}

\end{document}


• It is possible to hide but I would do what you have, and specify the colour in each cell, not however you should use \textcolor{red}{..........} not \color or you get the spurious extra space above the coloured rows as seen in your image. – David Carlisle Feb 9 '16 at 14:46
• @Werner, from answer in given link to desired change of text color in row is not so simply as maybe it seems on the first sight. An addendum to it with example how to change colors would be welcome. – Zarko Feb 9 '16 at 15:30

## 1 Answer

The following builds on the technique described in An improved \rowstyle that takes the cell contents as an argument, capturing each cell using collcell:

Each cell .. is set using \textcolor{red}{..} depending whether/not the switch \ifrowcolour has been set to \rowcolourtrue or \rowcolourfalse. Since these switches occur inside tabular cells (and therefore groups), they have to be set \globally in order for the change to exist beyond the cell scope.

For visual appeal, I'd suggest using booktabs for you table presentation(s).