[Tex/LaTex] Changing border colors of all tables in a document

colortables

I have a document full of tables (think 8-10 tables) – already written. Some are tabulars, others are longtables. I do not want to substantially change the existing code.

What is the fastest way (in terms of markup) to convert the colors of border and frame lines from black to a specified color? I have xcolor loaded?

This is for a class file, and if a single redefinition of the internals of tabular or longtable could do it, that would be perfect.

MWE:

\documentclass{article}
\usepackage{longtable}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\lipsum[1]

\begin{tabular}{llll}\hline
Some & Thing & Here & Now \\\hline
1 & 2 & 3 & 4 \\\hline
\end{tabular}

\lipsum[2]
\begin{longtable}[l]{|p{2.5cm}|p{5.5cm}|p{6cm}} \hline
Word & Play & Table \\\hline
This & is & now \\\hline
That & was & then \\\hline
\end{longtable}

\lipsum[2]

\end{document}

Best Answer

\documentclass{article}
\usepackage{longtable}
\usepackage{xcolor,colortbl} % <---
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\arrayrulecolor{red} % <---

\lipsum[1]

\begin{tabular}{llll}\hline
Some & Thing & Here & Now \\\hline
1 & 2 & 3 & 4 \\\hline
\end{tabular}

\lipsum[2]
\begin{longtable}[l]{|p{2.5cm}|p{5.5cm}|p{6cm}} \hline
Word & Play & Table \\\hline
This & is & now \\\hline
That & was & then \\\hline
\end{longtable}

\lipsum[2]

\end{document}
Related Question