Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

4.

12

Overlays

With an overlay, arbitrary hgraphical codei can be added to a tcolorbox. This code is executed
after the frame and interior are drawn and before the text content is drawn. Therefore, you
can decorate the tcolorbox with your own extensions. Common special cases are watermarks
which are implemented using overlays. See Subsection 10.3 from page 157 if you want to add
watermarks.

If you use the core package only, the hgraphical codei has to be pgf code and there is
not much assistance for positioning. Therefore, the usage of the /tcb/enhanced P. 196
mode from the library skins is recommended which allows tikz code and gives access to
/tcb/geometry nodes P. 129 for positioning.

/tcb/overlay=hgraphical codei
(no default, initially unset)
Adds hgraphical codei to the box drawing process. This hgraphical codei is drawn after the
frame and interior and before the text content.
% \tcbuselibrary{skins} % preamble
\tcbset{frogbox/.style={enhanced,colback=green!10,colframe=green!65!black,
enlarge top by=5.5mm,
overlay={\foreach \x in {2cm,3.5cm} {
\begin{scope}[shift={([xshift=\x]frame.north west)}]
\path[draw=green!65!black,fill=green!10,line width=1mm] (0,0) arc (0:180:5mm);
\path[fill=black] (-0.2,0) arc (0:180:1mm);
\end{scope}}}}}
\begin{tcolorbox}[frogbox,title=My title]
This is a \textbf{tcolorbox}.
\end{tcolorbox}

My title
This is a tcolorbox.

% \usetikzlibrary{patterns} % preamble
% \tcbuselibrary{skins}
% preamble
\tcbset{ribbonbox/.style={enhanced,colback=red!5!white,colframe=red!75!black,
fonttitle=\bfseries,
overlay={\path[fill=blue!75!white,draw=blue,double=white!85!blue,
preaction={opacity=0.6,fill=blue!75!white},
line width=0.1mm,double distance=0.2mm,
pattern=fivepointed stars,pattern color=white!75!blue]
([xshift=-0.2mm,yshift=-1.02cm]frame.north east)
-- ++(-1,1) -- ++(-0.5,0) -- ++(1.5,-1.5) -- cycle;}}}
\begin{tcolorbox}[ribbonbox,title=My title]
This is a \textbf{tcolorbox}.
\tcblower
This is the lower part.
\end{tcolorbox}
My title
This is a tcolorbox.
This is the lower part.

69

You might also like