How can I make this style of table in Latex with a specific colour gradient in borders, for example from dark blue to light blue, the First horizontal two borders should look like that :
1 Answers
Updated
Just a proof-of-concept, with the help of nicematrix package.
\documentclass{article}
\usepackage{enumitem} % for \tabularnote
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\setlength{\arrayrulewidth}{5pt} % just for test
\begin{NiceTabular}[hlines]{cccc}
2 & 1 & 3 & 0 \
3 & 3 & 1 & 0 \
3 & 3 & 1 & 0%
\tabularnote{default color}
\end{NiceTabular}%
\space
\begin{NiceTabular}[hlines, rules/color=white]{cccc}
2 & 1 & 3 & 0 \
3 & 3 & 1 & 0 \
3 & 3 & 1 & 0%
\tabularnote{axis-shading color}
\CodeAfter
\tikz{
\foreach \i in {1,...,\arabic{jCol}} {
\fill[left color=blue!50!black, right color=blue!50]
([shift={(-.5\tabcolsep, -.5\arrayrulewidth)}] \i-|1) rectangle
([shift={(.5\tabcolsep, .5\arrayrulewidth)}] \i-|last);
};
}
\end{NiceTabular}
\end{document}
Original answer
Here is a way combining the color series in xcolor package and the \arrayrulecolor, provided by colortbl package, to set color of horizontal rule in a tabular.
Check the corresponding package docs for more info.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\definecolorseries{tblrule}{rgb}{last}{blue!50!black}{blue!50}
\begin{document}
\resetcolorseries[5]{tblrule}
\setlength{\arrayrulewidth}{1pt}
\begin{tabular}{lr}
\arrayrulecolor{tblrule!!+}
\toprule
a & b \ \midrule
a & b \ \midrule
a & b \ \midrule
a & b \ \bottomrule
\end{tabular}
\end{document}
PS: Please keep the textual question description and the attached image for demonstration, as consistent as possible.
- 26,474
-
Thanks you, but you have made it in a vertical way, can you make it horizontal with the gradient of colours of course, Thanks you – TTT Jun 13 '21 at 13:48
-
Ah, with your newly added image showing what the "colour gradient" means, I knew my answer hit the wrong target. I'm afraid that traditional table packages cannot do the trick directly, and I will check if
nicematrixpackage is capable. – muzimuzhi Z Jun 13 '21 at 14:09 -
Hmmm,
nicematrix's\hlinemakes use of\noalignas well, but not pgf drawing. – muzimuzhi Z Jun 13 '21 at 14:24 -
-
@TTT Answer updated to show a proof-of-concept. And,
nicematrixis a general package not only forbeamer. – muzimuzhi Z Jun 13 '21 at 16:23




\rowcolorscommand which is accessible when adding\usepackage[table]{xcolor}to the preamble of a document. – leandriis Jun 13 '21 at 10:24xcolor.styand the tag is\definecolor{colorone}{cmyk}{0.5,0.25,0,0.1}– MadyYuvi Jun 13 '21 at 13:33