I am using the code of a good answer provided to Beautiful table samples question:
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\tcbset{tab1/.style={fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!75!black,colbacktitle=Salmon!40!white,
coltitle=black,center title,freelance,frame code={
\foreach \n in {north east,north west,south east,south west}
{\path [fill=red!75!black] (interior.\n) circle (3mm); };},}}
\tcbset{tab2/.style={enhanced,fonttitle=\bfseries,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!50!black,colbacktitle=Salmon!40!white,
coltitle=black,center title}}
\begin{document}
\begin{tcolorbox}[tab2,tabularx={X||Y|Y|Y|Y||Y}]
Group & One & Two & Three & Four & Sum \\\hline\hline
Red & 1000.00 & 2000.00 & 3000.00 & 4000.00 & 10000.00 \\\hline
Green & 2000.00 & 3000.00 & 4000.00 & 5000.00 & 14000.00 \\\hline
Blue & 3000.00 & 4000.00 & 5000.00 & 6000.00 & 18000.00 \\\hline\hline
Sum & 6000.00 & 9000.00 & 12000.00 & 15000.00 & 42000.00
\end{tcolorbox}
\end{document}
I need to write simple different words in each cell, but whatever the length of my words are, the columns always are of equal widths. I wonder how I can adjust the code so that each column width becomes as long as the longest word contained in one of its cells.
X
andY
columntypes, the later being nothing different thanX
again.X
andY
position the text either to left of right ... thank you for the hinttabulary
package, buttcolorbox
doesn't support that as a possibility. See e.g. Auto-fit table column widths based on content