# Fancy colored array in LaTeX?

I would like to reproduce these kinds of arrays in Latex (probably with tcolorbox) but I have no idea how to achieve this. So is there a way to make these kinds of tables ?

Note : I would like the switching between colors from one line to another to be automatic.

The colortbl package is enough to create such tables as the other commentors wrote. The following example code uses \usepackage[svgnames,table]{xcolor} where the option table loads colortbl:

\documentclass[a4paper,12pt]{article}
\usepackage{array}
\usepackage[svgnames,table]{xcolor}

\newcommand*{\arraycolor}[1]{\protect\leavevmode\color{#1}}
\newcolumntype{A}{>{\columncolor{blue!50!white}}c}
\newcolumntype{B}{>{\columncolor{LightGoldenrod}}c}
\newcolumntype{C}{>{\columncolor{FireBrick!50}}c}
\newcolumntype{D}{>{\columncolor{Gray!42}}c}

\begin{document}

\begin{center}
\sffamily
\arrayrulecolor{white}
\arrayrulewidth=1pt
\renewcommand{\arraystretch}{1.5}
\rowcolors[\hline]{3}{.!50!White}{}
\begin{tabular}{A|B|C}
\multicolumn{3}{D}{\bfseries Example table}\\
\rowcolor{.!50!Black}
\arraycolor{White}\bfseries First column &
\arraycolor{White}\bfseries Second column&
\arraycolor{White}\bfseries Third column\\
1 & A & E\\
2 & B & F\\
3 & C & G\\
4 & D & H\\
\end{tabular}
\end{center}

\end{document}


• Hmmm... But this code does not include any reference to colortbl ? – Vincent Fourmond Nov 19 '17 at 10:38
• @VincentFourmond Not directly, but via \usepackage[svgnames,table]{xcolor} where the option table loads colortbl – Thomas F. Sturm Nov 20 '17 at 10:39
• Ah, OK. That may be worth adding to the answer to avoid confusing other readers ? – Vincent Fourmond Nov 20 '17 at 13:53
• @VincentFourmond Done. – Thomas F. Sturm Nov 22 '17 at 13:00