Tcolorbox with different background color and table

colortablestcolorbox

everyone!
I'm new to tcolorbox and I want to achieve something that I didn't think would take so much time without any results. Usually, documentation and googling gets me there. But, for this one I had no luck and the tcolorbox documentation is just overwhelming. I present the code of my work up until now:

\begin{tcolorbox}[colback=blue!83,arc=0pt,outer arc=0pt]
    \begin{minipage}{.25\textwidth} 
        \bf \textcolor{white}{1}  \\  \textcolor{white}{2} \\ \textcolor{white}{3}
    \end{minipage}%
    \begin{minipage}{.75\textwidth} 
        \phantom{1} \\ \phantom{1} \\ \phantom{1} %used for painting
    \end{minipage}
\end{tcolorbox}

I used minipage to separate easier the box and also to try and paint the right minipage with a different color (gray) as I did not manage to do this via the colorbox options. What I did to achieve this was to put the minipage inside an fcolorbox. That didn't give me the desired result as all it painted was the three rows, leaving some space around the gray fcolorbox still painted blue. I also tried other things with similar results. I just want all the right minipage to be gray. Ideally, I want the whole tcolorbox to be something like a 3 by 2 table and also no frame. So the expected output is the following:

enter image description here

Best Answer

Under the assumption that the image you included in your quesion is a sketch of the expected output, I wouldn't recommend tcolorbox to reproduce that. Instead a package dedicated to tables, such as tabularray or nicematrix should come in handy:

enter image description here

\documentclass{article}

\usepackage{xcolor}
\usepackage{tabularray}

\definecolor{myblue}{RGB}{46, 116, 181}
\definecolor{mygray}{RGB}{217, 217, 217}

\begin{document}
\noindent
\begin{tblr}{colspec={X[1]X[3]}, 
             hlines, vlines,
             column{1}={bg=myblue, fg=white, font=\bfseries}, 
             column{2}={bg=mygray}} 
        1 & \\
        2 & \\
        3 & \\
\end{tblr}
\end{document}

\documentclass{article}

\usepackage{xcolor}
\usepackage{nicematrix}

\definecolor{myblue}{RGB}{46, 116, 181}
\definecolor{mygray}{RGB}{217, 217, 217}

\begin{document}
\noindent
\begin{NiceTabularX}{\linewidth}{>{\bfseries\color{white}}X[1]X[3]}[hvlines]
\CodeBefore
\columncolor{myblue}{1}
\columncolor{mygray}{2}
\Body
        1 & \\
        2 & \\
        3 & \\
\end{NiceTabularX}
\end{document}
Related Question