tikz.dev / tcolorbox Manual

The tcolorbox package

Libraries

15 Library vignette

The library is loaded by a package option or inside the preamble by:

This also loads the skins library, see Section 10, and the fadings library of TikZ [Tantau 2023].

15.1 Vignette Drawing
15.2 Generic Geometry Settings
  • /tcb/vig/xmin=⟨length⟩(no default, initially 0pt)New: 2016-04-22

  • Sets the lower horizontal limit of a \tcbvignette.

  • /tcb/vig/xmax=⟨length⟩(no default, initially 1cm)New: 2016-04-22

  • Sets the upper horizontal limit of a \tcbvignette.

  • /tcb/vig/ymin=⟨length⟩(no default, initially 0pt)New: 2016-04-22

  • Sets the lower vertical limit of a \tcbvignette.

  • /tcb/vig/ymax=⟨length⟩(no default, initially 1cm)New: 2016-04-22

  • Sets the upper vertical limit of a \tcbvignette.

Compiled output

\begin{tikzpicture}
\fill [black!20] (0,0) rectangle (3,2);
\path [pattern=checkerboard,pattern color=black!30]
(0,0) rectangle (3,2);
\tcbvignette{xmin=1cm,xmax=2.5cm,ymin=0.5cm,ymax=1.75cm}
\end{tikzpicture}

Compiled output

\begin{tikzpicture}
\fill [black!20] (0,0) rectangle (3,2);
\path [pattern=checkerboard,pattern color=black!30]
(0,0) rectangle (3,2);
\tcbvignette{lower left corner={1,0.5},
upper right corner={2.5,1.75}}
\end{tikzpicture}
  • /tcb/vig/inside node=⟨name⟩(style, initially unset)New: 2016-04-22

  • Places the \tcbvignette inside the node with the given ⟨name⟩. The outer limits of the vignette are adapted to the node geometry.

    Compiled output

    \begin{tikzpicture}
    \node[minimum width=2cm,minimum height=1cm] (A) {Node A};
    \tcbvignette{inside node=A}
    \draw[very thick] (A.south west) rectangle (A.north east);
    \end{tikzpicture}
  • /tcb/vig/outside node=⟨name⟩(style, initially unset)New: 2016-04-22

  • Places the \tcbvignette outside the node with the given ⟨name⟩. The inner limits of the vignette are adapted to the node geometry.

    Compiled output

    \begin{tikzpicture}
    \node[minimum width=2cm,minimum height=1cm] (A) {Node A};
    \tcbvignette{outside node=A}
    \draw[very thick] (A.south west) rectangle (A.north east);
    \end{tikzpicture}
  • /tcb/vig/over node=⟨name⟩(style, initially unset)New: 2016-04-22

  • Places the \tcbvignette over the node with the given ⟨name⟩. The outer limits of the vignette are adapted to the node geometry, but are shifted to the outside by /tcb/vig/over node offset.

    Compiled output

    \begin{tikzpicture}
    \node[minimum width=2cm,minimum height=1cm] (A) {Node A};
    \tcbvignette{over node offset=1mm,over node=A}
    \draw[very thick] (A.south west) rectangle (A.north east);
    \end{tikzpicture}
  • /tcb/vig/north size=⟨length⟩(no default, initially 2mm)New: 2016-04-22

  • Sets the thickness of the north vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{north size=4mm}
    \end{tikzpicture}
  • /tcb/vig/south size=⟨length⟩(no default, initially 2mm)New: 2016-04-22

  • Sets the thickness of the south vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{south size=4mm}
    \end{tikzpicture}
  • /tcb/vig/east size=⟨length⟩(no default, initially 2mm)New: 2016-04-22

  • Sets the thickness of the east vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{east size=4mm}
    \end{tikzpicture}
  • /tcb/vig/west size=⟨length⟩(no default, initially 2mm)New: 2016-04-22

  • Sets the thickness of the west vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{west size=4mm}
    \end{tikzpicture}

/tcb/vig/north size, /tcb/vig/south size, etc. have to be set before /tcb/vig/outside node is used.

15.3 Generic Color and Style Settings
  • /tcb/vig/north style={⟨style⟩}(no default, initially red!50!white)New: 2016-04-22

  • Sets TikZ ⟨style⟩ options for the north vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{north style=blue}
    \end{tikzpicture}
  • /tcb/vig/south style={⟨style⟩}(no default, initially red!50!black)New: 2016-04-22

  • Sets TikZ ⟨style⟩ options for the south vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{south style={draw=blue,fill=yellow}}
    \end{tikzpicture}
  • /tcb/vig/east style={⟨style⟩}(no default, initially red!75!black)New: 2016-04-22

  • Sets TikZ ⟨style⟩ options for the east vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{east style={left color=yellow!75!black,
    right color=blue!75!black}}
    \end{tikzpicture}
  • /tcb/vig/west style={⟨style⟩}(no default, initially red!75!white)New: 2016-04-22

  • Sets TikZ ⟨style⟩ options for the west vignette part.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{west style={preaction={fill=black!20},
    pattern=checkerboard,
    pattern color=black!30}}
    \end{tikzpicture}
  • /tcb/vig/scope={⟨style⟩}(no default, initially empty)New: 2016-05-24

  • The four vignette parts are drawn inside a TikZ scope environment which takes the given ⟨style⟩ as option.

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{scope={transparency group,opacity=0.25}}
    \end{tikzpicture}
  • /tcb/vig/draw method=direct|clipped(no default, initially direct)New: 2016-04-22

  • Especially, if shadings or fadings are used, the drawn vignette graphs are displayed sometimes not as perfect as expected. Glitches and imperfections are very dependent on the previewer software. The /tcb/vig/draw method intends to give a choice of alternative drawing methods.

    • direct: The vignette parts are drawn/filled by using a single TikZ graph. This is the preferred (and default) method for solid color graphs.

    • clipped: The vignette parts are drawn somewhat oversized and are clipped to the intended region. In combination with shadings and fadings this seems to give a better/different optical result (depends on the previewer).

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{color from=red to yellow}
    \end{tikzpicture}

    Compiled output

    \begin{tikzpicture}
    \tcbvignette{color from=red to yellow,draw method=clipped}
    \end{tikzpicture}

    This option is a stopgap and may be changed or preferably removed in future.

15.4 Generic Fading Settings

The fadings library of TikZ [Tantau 2023] is loaded automatically by the vignette library. Amongst others, the fadings west, east, north, and south are defined inside the fadings library.

The vignette library adds some more fadings called semi west, semi east, semi north, and semi south. These fadings are much weaker than the normal fadings.

Compiled output

\begin{tikzpicture}
\fill [black!20] (0,0) rectangle (1,1);
\path [pattern=checkerboard,pattern color=black!30]
(0,0) rectangle (1,1);
\fill [path fading=semi west,blue] (0,0) rectangle (1,1);
\end{tikzpicture}
Compiled output

It is possible to assign different fadings for each side of the vignette, if needed. Therefore, the fadings have to be applied individually with the four style options /tcb/vig/north style, /tcb/vig/south style, /tcb/vig/east style, and /tcb/vig/west style.

Compiled output

\begin{tikzpicture}
\fill [black!20] (-0.5,-0.5) rectangle (1.5,1.5);
\path [pattern=checkerboard,pattern color=black!30]
(-0.5,-0.5) rectangle (1.5,1.5);
\tcbvignette{
north style={blue,path fading=south},
east style ={blue,path fading=semi west},
south style={blue,path fading=semi north},
west style ={blue,path fading=east}
}
\end{tikzpicture}

Compiled output

\begin{tikzpicture}
\fill [black!20] (-0.5,-0.5) rectangle (1.5,1.5);
\path [pattern=checkerboard,pattern color=black!30]
(-0.5,-0.5) rectangle (1.5,1.5);
\tcbvignette{
north style={blue,path fading=west},
east style ={blue,path fading=south},
south style={red,path fading=east},
west style ={red,path fading=north}
}
\end{tikzpicture}
15.5 Vignette as Underlay
15.6 Vignette as Finish

Compiled output