Tcolorbox set background color (colback) to color gradient / gradient to transparent

gradienttcolorboxtransparent

I wish to create a tcolorbox with a background that fades from a solid color to white, or even transparent, to be able to use it everywhere.

I have tried using [enhanced jigsaw, frame style={left color=black, right color=white}], but that only changes the color of the frame around the tcolorbox, not of the background. And the only option to change the opacity of the background that I could find (opacityback) seems to change everything at once.

The following is my box so far. The gradient you see in the frame is nice, but not what I want. I'd like the background (entirely transparent here) to fade from black to white/transparent.

What I have been able to do so far.

The code for this box is as follows:

\usepackage[skins]{tcolorbox}

\begin{document}
\begin{tcolorbox}[title=My tcolorbox, boxrule=2mm, enhanced jigsaw,  frame style={left color=black, right color=white}, opacityback=0]
(Text content of the box, irrelevant)
\end{tcolorbox}
\end{document}

Best Answer

You want interior style, not frame style:

\documentclass{report}

\usepackage[skins]{tcolorbox}

\begin{document}
\begin{tcolorbox}[title=My tcolorbox, boxrule=2mm, enhanced jigsaw,
  frame style={left color=black, right color=white}, %opacityback=0, removed
  interior style={left color=black, right color=white} % added
]
(Text content of the box, irrelevant)
\end{tcolorbox}
\end{document}

code output