summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tcolorbox/tcbskins.code.tex
blob: fcafaca32066a2eb0aee7afdf0aea766769f5202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
%% The LaTeX package tcolorbox - version 1.30 (2012/04/20)
%% tcbskins.code.tex: Code for colorboxes with different skins
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2012 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\makeatletter
\def\tcblibrary@skins@loaded{}

\RequirePackage{tikz}[2010/10/13]

\def\tcb@creategeonodes@true{%
  \begin{scope}[every node/.style={line width=0mm,inner sep=0mm,draw=none,fill=none,rectangle}]
    \node[name=frame,at={(0,0)},above right,minimum width=\kvtcb@width,minimum height=\tcb@height]{};
    \node[name=interior,at={({\kvtcb@boxrule},{\kvtcb@boxrule})},above right,minimum width=\kvtcb@width-\kvtcb@boxrule*2,minimum height=\tcb@innerheight]{};
    \iftcb@lowerspace%
    \node[name=segmentation,at={({\kvtcb@boxrule},{\kvtcb@boxrule+\kvtcb@boxsep*2+\kvtcb@bottom+\tcb@height@lower})},above right,
       minimum width=\kvtcb@width-\kvtcb@boxrule*2,minimum height=\kvtcb@middle*2]{};
    \fi%
  \end{scope}%
}

% fill frame
\def\tcb@drawframe@path{%
  \path[fill=\kvtcb@colframe,rounded corners=\kvtcb@arc+\kvtcb@boxrule,frame@style]
  (frame.south west) rectangle (frame.north east);%
}

% fill inner box with title
\def\tcb@drawwithtitle@path{%
  \path[fill=\kvtcb@colback,interior@style] (interior.north west)
    --(interior.north east)[rounded corners=\kvtcb@arc]
    --(interior.south east)--(interior.south west)[sharp corners]
    -- cycle;%
}

% fill inner box without title
\def\tcb@drawwithouttitle@path{%
  \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
  (interior.south west) rectangle (interior.north east);%
}

% draw segmentation line
\def\tcb@drawlower@path{%
  \path[draw=\kvtcb@colframe,dashed,segmentation@style]
  (segmentation.west)--(segmentation.east);%
}

\def\tcb@drawframe@freelance{\tcb@frame@code}
\def\tcb@drawwithtitle@freelance{\tcb@interiortitled@code}
\def\tcb@drawwithouttitle@freelance{\tcb@interior@code}
\def\tcb@drawlower@freelance{\tcb@segmentation@code}

\tcbset{%
  frame style/.code={\tikzset{frame@style/.style={#1}}},%
  frame code/.code={\def\tcb@frame@code{#1}},%
  frame code/.default=\tcb@drawframe@standard,%
  interior style/.code={\tikzset{interior@style/.style={#1}}},%
  interior titled code/.code={\def\tcb@interiortitled@code{#1}},%
  interior titled code/.default=\tcb@drawwithtitle@standard,%
  interior code/.code={\def\tcb@interior@code{#1}},%
  interior code/.default=\tcb@drawwithouttitle@standard,%
  segmentation style/.code={\tikzset{segmentation@style/.style={#1}}},%
  segmentation code/.code={\def\tcb@segmentation@code{#1}},%
  segmentation code/.default=\tcb@drawlower@standard,%
  colbacklower/.store in=\kvtcb@colbacklower,%
}

\tcbset{%
  frame style=,%
  interior style=,%
  segmentation style=,%
  frame code,%
  interior titled code,%
  interior code,%
  segmentation code,%
  colbacklower=black!15!white,
}

\tcbset{skin@enhanced/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=path,
  interior engine=path,segmentation engine=path
}}

\tcbset{skin@freelance/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=freelance,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance
}}

\tcbset{skin@bicolor/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  interior style=,
  interior titled code={%
    \iftcb@lowerspace%
    \path[fill=\kvtcb@colback,interior@style]
      (segmentation.west) rectangle (interior.north east);%
    \else%
    \path[fill=\kvtcb@colback,interior@style]
      (interior.north west)--(interior.north east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;%
    \fi},
  interior code={%
    \iftcb@lowerspace%
    \path[fill=\kvtcb@colback,interior@style]
      (segmentation.east)--(segmentation.west)[rounded corners=\kvtcb@arc]
      -- (interior.north west)--(interior.north east)[sharp corners]
      -- cycle;%
    \else%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
      (interior.south west) rectangle (interior.north east);%
    \fi},
  segmentation code={%
    \path[fill=\kvtcb@colbacklower,segmentation@style]
    ([yshift=0.1mm]segmentation.west)--([yshift=0.1mm]segmentation.east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;}%
}}

\tcbset{skin@beamer/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  boxrule=0mm,arc=2mm,frame style={fill=\kvtcb@colframe,drop shadow},
  fonttitle=\bfseries,interior style=,
  interior titled code={%
    \iftcb@lowerspace%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.west) rectangle (interior.north east);%
    \else%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (interior.north west)--(interior.north east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;%
    \fi%
    \path[top color=\kvtcb@colframe,bottom color=\kvtcb@colback]
      ([yshift=-0.5mm]interior.north west) rectangle
      ([yshift=0.5mm]interior.north east);},
  interior code={%
    \iftcb@lowerspace%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.east)--(segmentation.west)[rounded corners=\kvtcb@arc]
      -- (interior.north west)--(interior.north east)[sharp corners]
      -- cycle;%
    \else%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,rounded corners=\kvtcb@arc,interior@style]
      (interior.south west) rectangle (interior.north east);%
    \fi},
  segmentation code={%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.west)--(segmentation.east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;}%
}}

\tcbset{skin@widget/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  arc=0.5mm,frame style={fill=\kvtcb@colframe},
  interior style=,segmentation style=,fonttitle=\bfseries,
  interior titled code={%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
    (interior.south west) rectangle ([xshift={-\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north east);
    \path[left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback,interior@style]
    (interior.north east)--(interior.north west)[rounded corners=\kvtcb@arc]
      -- ([xshift={\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north west)--([xshift={-\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north east)[sharp corners]
      -- cycle;},
  interior code={%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
    (interior.south west) rectangle (interior.north east);},
  segmentation code={%
    \path[left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback,segmentation@style]
    ([yshift={-\kvtcb@middle/4}]segmentation.west) rectangle ([yshift={\kvtcb@middle/4}]segmentation.east);}%
}}