{colortbl} is a package which implements a flexible mechanism for giving coloured ‘panels’ behind specified columns in a table. It requires the array and color packages.

The package offers commands to color rows (\rowcolor, see also ), columns (\columncolor), cells (\cellcolor, see also ) and rules (\arrayrulecolor) in a tabular. The basic use of thouse commands is shown in the following short examples:

enter image description here

\rowcolor[<color model>]{<colour>}[<left overhang>][<right overhang>]
\documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{c|c|c}
\rowcolor{yellow}  1 & 2 & 3 \\
\hline
                   4 & 5 & 6 \\
                   7 & 8 & 9 \\
\end{tabular}
\end{document}

enter image description here

\columncolor[<color model>]{<colour>}[<left overhang>][<right overhang>]
\documentlcass{article}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{c|>{\columncolor{red}}c|c}
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}
\end{document}

enter image description here

\documentlcass{article}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{c|>{\columncolor{red}}c|c}
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}
\end{document}

enter image description here

\documentclass{article}
\usepackage{colortbl}
\begin{document}
\arrayrulecolor{green}
\begin{tabular}{c|c|c}
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}
\end{document}

enter image description here

As can be seen from the above image, rowcolor overrides columncolor while cellcolor overrides both.

\documentclass{article}
\usepackage{colortbl}
\begin{document}
\arrayrulecolor{green}
\begin{tabular}{c|>{\columncolor{red}}c|c}
  \rowcolor{yellow}1 & 2 & \cellcolor{blue}3 \\
  \hline
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}
\end{document}

Frequently asked questions regarding the colortbl package:

1. Disappearing lines due to the zoom factor of the pdf viewer:

Solution for disappearing table/cell borders with \rowcolor in the PDF viewer depending on zoom?

Displaying the horizontal and vertical lines of a table after coloring rows

2. \cline vs. \hhline for partial horizontal lines

Colored tables and cline/hhline

3. \multirow text being covered by color/ cell is not completely colored

Color running over text in multirow column

color multirow in a table

4. Combination of rowcolor and booktabs

Booktabs and colortbl not filling height of row