Like this?
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tcolorbox}
%\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}
%table
%\newcolumntype{Y}{>{\centering\arraybackslash}X}
\tcbset
{
tab2/.style=
{
enhanced,
fonttitle=\bfseries,
fontupper=\normalsize\sffamily,
colback=white!10!white,
colframe=red!50!black,
colbacktitle=Salmon!40!white,
coltitle=black,center title
}
}
\newtcolorbox{mytable}[3][]
{
tab2,
tabular*={\renewcommand{\arraystretch}{1.7}}{#2},
title=Table \ref{#3},
%hbox,
before={\begin{table}[htb]\refstepcounter{table}\label{#3}},
after={\end{table}},
#1
}
\makeatletter
\tcbset{
tabular*/.style 2 args={%
boxsep=0pt,top=0pt,bottom=0pt,leftupper=0pt,rightupper=0pt,
toptitle=1mm,bottomtitle=1mm,boxrule=0.5mm,hbox,
before upper={\arrayrulecolor{tcbcol@frame}\def\arraystretch{1.1}#1%
\tcb@hack@currenvir\tabular{#2}},
after upper=\endtabular\arrayrulecolor{black}},
}
\makeatother
\begin{document}
\begin{mytable}{c|c}{kk}
group & one \\\hline
red & 1000.00 \\\hline
green & 2000.00 \\\hline
blue & 3000.00 \\\hline
sum & 6000.00
\end{mytable}
\end{document}
I have defined a tabular
similar to tabularx
:
\makeatletter
\tcbset{
tabular*/.style 2 args={%
boxsep=0pt,top=0pt,bottom=0pt,leftupper=0pt,rightupper=0pt,
toptitle=1mm,bottomtitle=1mm,boxrule=0.5mm,hbox,
before upper={\arrayrulecolor{tcbcol@frame}\def\arraystretch{1.1}#1%
\tcb@hack@currenvir\tabular{#2}},
after upper=\endtabular\arrayrulecolor{black}},
}
\makeatother
Best Answer
The following should be closer to the desired output:
Update regarding different border widths:
The thicker border on the bottom and left side of the box reminded me of a drop shadow, so here is such a version as well: