# Change color of table boundary caption, label and table contents

Please find the code and the corresponding output below

 \documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{table*}[]
\centering
\renewcommand{\arraystretch}{1.2}
\caption{\textcolor{red}{Pole}}
\label{table5}
\begin{tabular}{|c|c|c|c|}
\hline
\begin{tabular}[c]{@{}c@{}}\textcolor{red}{OHO} \\ \textcolor{red}{MF} \\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OYE}\\ \textcolor{red}{OME}\\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{RA}\\ \textcolor{red}{OY} \\ \textcolor{red}{M}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{FR}\\ \textcolor{red}{MOO}\\ \textcolor{red}{$M$}\end{tabular} \\\arrayrulecolor{red}  \hline
\textcolor{red}{-1.5       }                                                                            & \textcolor{red}{-2}                                                                                                         &                                                                                                        &                                                                                      \\ \hline
\textcolor{red}{-2.1634 + 1.2490i }                                                                                   & \textcolor{red}{-3}
&                                                                                                        &
\\ \hline
\textcolor{red}{-2.7     }
& \textcolor{red}{-4}
&
&
\\ \hline
\end{tabular}
\end{table*}
\end{document}


I want to make all the borders and the contents of the table in red color. However, as seen in the attached figure, the color of the topmost row and column is not coming in color. Also, the color of "Table 1: " is not in red color. So, my query is how to make the complete table in red color?

• If you add \color{red} after \centering everything will become red. – user121799 Apr 17 '19 at 5:09
• Got it. But still "Table 1: " is not coming red. How to do that? – ShiS Apr 17 '19 at 5:11

I will be happy to remove this but when I compile

\documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{table*}[]
\centering\color{red}
\renewcommand{\arraystretch}{1.2}
\caption{\textcolor{red}{Pole}}
\label{table5}
\begin{tabular}{|c|c|c|c|}
\hline
\begin{tabular}[c]{@{}c@{}}\textcolor{red}{OHO} \\ \textcolor{red}{MF} \\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OYE}\\ \textcolor{red}{OME}\\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{RA}\\ \textcolor{red}{OY} \\ \textcolor{red}{M}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{FR}\\ \textcolor{red}{MOO}\\ \textcolor{red}{$M$}\end{tabular} \\\arrayrulecolor{red}  \hline
\textcolor{red}{-1.5       }                                                                            & \textcolor{red}{-2}                                                                                                         &                                                                                                        &                                                                                      \\ \hline
\textcolor{red}{-2.1634 + 1.2490i }                                                                                   & \textcolor{red}{-3}
&                                                                                                        &
\\ \hline
\textcolor{red}{-2.7     }
& \textcolor{red}{-4}
&
&
\\ \hline
\end{tabular}
\end{table*}
\end{document}


with pdflatex I get

If you load caption, you may want to try

\documentclass{article}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\usepackage{amsmath}
\DeclareCaptionFont{red}{\color{red}}
\begin{document}
\begin{table*}[]
\centering\color{red} \captionsetup{labelfont={red},textfont=red}
\renewcommand{\arraystretch}{1.2}
\caption{Pole}
\label{table5}
\begin{tabular}{|c|c|c|c|}
\hline
\begin{tabular}[c]{@{}c@{}}OHO \\ MF \\ $P$\end{tabular} & \begin{tabular}[c]{@{}c@{}}OYE\\ OME\\ $P$\end{tabular} & \begin{tabular}[c]{@{}c@{}}RA\\ OY \\ M\end{tabular} & \begin{tabular}[c]{@{}c@{}}FR\\ MOO\\ $M$\end{tabular} \\\arrayrulecolor{red}  \hline
$-1.5$
& $-2$                                                                                                         &                                                                                                        &                                                                                      \\ \hline
$-2.1634 + 1.2490\,\mathrm{i}$
& $-3$
&                                                                                                        &
\\ \hline
$-2.7$
& $-4$
&
&
\\ \hline
\end{tabular}
\end{table*}
\end{document}


• Somehow when I try to compile this table in my complete document I am not getting it. But when I compile it individually alone I get the red color in "Table 1:". Seems like might be some package clash or something like that – ShiS Apr 17 '19 at 5:33
• @ShiS Do you load the caption package? At least when I add \usepackage{caption} I also get a black caption. – user121799 Apr 17 '19 at 5:34
• Yes, I had loaded it. When I remove it, "Table 1" is coming in red, but a few other errors are coming. Isn't it possible to do it while using caption package – ShiS Apr 17 '19 at 5:36
• @ShiS I added a proposal for that as well. (Of course you may want to drop some \textcolor commands and typeset the numbers in math mode and use \mathrm{i} for the imaginary i.) – user121799 Apr 17 '19 at 5:40
• This gives me exactly the output I wanted. Thanks. I have also dropped the redundant commands – ShiS Apr 17 '19 at 5:43