[Tex/LaTex] How to change color of column in table

colortables

I am using this code for a table:

\documentclass[a4paper, 12pt, oneside]{Thesis}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{array}

\begin{document}
\begin{table}[H]
\centering
{\renewcommand{\arraystretch}{2}
\begin{tabular}{ |c|C{5cm}|C{5cm}|C{5cm}|}
\hline
\textbf{} & \textbf{A} & \textbf{B} & \textbf{C} \\ 
\hline
 & Means of Mounting & Material & Means of De-mounting \\ \hline   
1 & Friction & Rubber & Lever \\ \hline
2 & Tight Fit(Formschluss) & Magnet & Complete Removal \\ \hline
3 & Holes & Alloy & Spring/Elasticity \\ \hline

\end{tabular}}
\caption{Morphological Box}

\end{table}

\end{document}

I want to color the background of each column

Best Answer

enter image description here

\documentclass[a4paper, 12pt, oneside]{Thesis}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{array}

\begin{document}
\begin{table}
\centering
{\renewcommand{\arraystretch}{2}
\begin{tabular}{ |>{\columncolor{red!30}}c|
                  >{\columncolor{blue!30}}p{5cm}|
                  >{\columncolor{yellow!30}}p{5cm}|
                  >{\columncolor{green!30}}p{5cm}|}
\hline
\textbf{} & \textbf{A} & \textbf{B} & \textbf{C} \\
\hline
 & Means of Mounting & Material & Means of De-mounting \\ \hline
1 & Friction & Rubber & Lever \\ \hline
2 & Tight Fit(Formschluss) & Magnet & Complete Removal \\ \hline
3 & Holes & Alloy & Spring/Elasticity \\ \hline

\end{tabular}}
\caption{Morphological Box}

\end{table}

\end{document}

Details how to color tables you can find in documentation of package colortbl (which is called and extended by option table when loading xcolor).

In your MWE you not define column type C{...}, so I use p{...}. Also your table is wider then text width.