2

How do I pick the foreground (text) color in xcolor table for the whole row? such that the letters appear white with blue background in this table (instead of black which is bad for constrast):

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
    \begin{tabular}{lll}
    \rowcolor{blue}%\textcolor{white}
    10 & 20 & 30 \\
    11 & 21 & 31 \\
    12 & 22 & 32 \\
    \end{tabular}
\end{document}

blackonblueisbad

  • @GonzaloMedina, thanks for the pointer, is it possible to make it work without using another package (tabu)? Also I couldn't make rowcolor and rowfont work at the same time. – alfC May 6 '13 at 4:08
  • you need to use \rowfont first: \documentclass{article} \usepackage[table]{xcolor} \usepackage{tabu} \begin{document} \begin{tabu}{lll} \rowfont{\color{white}}\rowcolor{blue} 10 & 20 & 30 \ 11 & 21 & 31 \ 12 & 22 & 32 \ \end{tabu} \end{document}. For a solution without tabu, let me see if I can find a link to an answer by David Carlisle. – Gonzalo Medina May 6 '13 at 14:10
  • Yep. Here's the link to David's answer: tex.stackexchange.com/a/62466/3954 you can adapt it to use standard l columns instead of X columns. – Gonzalo Medina May 6 '13 at 14:14

Browse other questions tagged or ask your own question.