# tcolorbox with curved sides

I would like to create using tcolorbox a filled breakable rectangle with all curved side such as one shown in the

I am not able to fill it correctly. If someone is willing to help, I would be grateful.

• We kindly suggest you to include a full minimal working example (MWE) to show what you have worked so far on, so we can help you further with this. – Cragfelt Dec 30 '17 at 10:06
• If Christian Hupfer's answer (below) solved your problem please mark it as accepted by clicking the check mark next to the answer. see: How does accepting an answer work? for more information. – Cragfelt Dec 30 '17 at 21:08

This can be achieved with layers and underlays.

The breakability is 'difficult' -- it is necessary to redraw the box bottoms and box bottoms depending on the position in the breaking sequence (in tcolorbox parlour: first, middle and last) -- this can be done with underlay first and underlay middle and last, and if the box is unbroken, use underlay unbroken.

The interior background of the real tcolorbox is not drawn at all, such that it does not paint over the following underlays.

The colors for the inner box and outer boxes can be changed by using new pgfkeys as done in \tcbset.

Please note that this might fail for the last box of a break sequence and produce hilarious results.

Now with broken boxes and the ability to change colours:

\documentclass{article}

\usepackage{blindtext}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shapes.geometric,calc,backgrounds}

\newlength{\internalshift}
\setlength{\internalshift}{20pt}

\pgfdeclarelayer{background rounded rect}
\pgfsetlayers{background rounded rect,main}

\tcbset{%
innerboxcolback/.colorlet=tcbcol@innerback,
outerboxcolback/.colorlet=tcbcol@outerback,
outerboxcolframe/.colorlet=tcbcol@outerboxframe,
innerboxcolback=yellow,
outerboxcolback=cyan!20,
outerboxcolframe=blue,
}

\makeatletter
\newtcolorbox{curvedbox}[1][]{%
enhanced,
breakable,
colback=blue!20,
colframe=green,
innerboxcolback=yellow,
arc=\internalshift,
auto outer arc,
interior hidden,
frame hidden,
attach boxed title to top center,
boxed title style={colback=tcbcol@outerback,enhanced,frame hidden},
coltitle=black,
title={Title},
underlay={% Drawing the blue
\begin{pgfonlayer}{background rounded rect}
\draw[tcbcol@outerboxframe, line width=1.5pt, fill=tcbcol@outerback,rounded corners=1.5\internalshift] ($(frame.north west) + (0pt,1\internalshift)$)  rectangle ($(frame.south east) - (0pt,\internalshift)$);
\draw[tcbcol@outerboxframe, line width=1.5pt,fill=tcbcol@outerback,rounded corners=1.5\internalshift] ($(frame.north west) - (0.5\internalshift,0.5\internalshift)$) rectangle ($(frame.south east) + (0.5\internalshift,0.5\internalshift)$);
\end{pgfonlayer}
},% End of underlay
% Now the yellow box underlay if the box is unbroken
underlay unbroken={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},
% Now the yellow box underlay if the box is broken, provide rounded rectangles for the first at the bottom and for the middle and last on the top.
underlay first={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},
underlay middle and last={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},
#1
}
\makeatother

\begin{document}

\begin{curvedbox}
\blindtext[10]
\end{curvedbox}
\end{document}


• Thanks for your answer. You saved me a lot of time. Thank you once – Zeljko Hrcek Dec 30 '17 at 20:26