0

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}

1 Answer 1

2

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

1
  • Yes, thank you! Seems like I overlooked quite a few gradient examples in the documentation...
    – A Potato
    Commented Oct 20, 2022 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .