Debian Codegraph @

texmf-dist/source/latex/catppuccinpalette/beamercolorthemecatppuccin.dtx

raw
1 % \iffalse meta-comment
2 %
3 % MIT License
4 %
5 % Copyright (c) 2025 Catppuccin
6 %
7 % Permission is hereby granted, free of charge, to any person obtaining a copy
8 % of this software and associated documentation files (the "Software"), to deal
9 % in the Software without restriction, including without limitation the rights
10 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 % copies of the Software, and to permit persons to whom the Software is
12 % furnished to do so, subject to the following conditions:
13 %
14 % The above copyright notice and this permission notice shall be included in all
15 % copies or substantial portions of the Software.
16 %
17 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 % SOFTWARE.
24 %
25 % \fi
26 %
27 % \iffalse
28 %<*driver>
29 \ProvidesFile{beamercolorthemecatppuccin.dtx}
30 %</driver>
31 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
32 %<package>\ProvidesPackage{beamercolorthemecatppuccin}
33 %<*package>
34 [2025/07/19 v1.2.0 catppuccin beamer color theme]
35 %</package>
36 %
37 %<*driver>
38 \documentclass{ltxdoc}
39 \usepackage{beamerarticle}
40 \usepackage{beamercolorthemecatppuccin}[2024/02/27]
41 \usepackage{tabularx, booktabs}
42 \EnableCrossrefs
43 \CodelineIndex
44 \RecordChanges
45 \begin{document}
46 \DocInput{beamercolorthemecatppuccin.dtx}
47 \PrintChanges
48 \PrintIndex
49 \end{document}
50 %</driver>
51 % \fi
52 %
53 % \CheckSum{98}
54 %
55 % \CharacterTable
56 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
57 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
58 % Digits \0\1\2\3\4\5\6\7\8\9
59 % Exclamation \! Double quote \" Hash (number) \#
60 % Dollar \$ Percent \% Ampersand \&
61 % Acute accent \' Left paren \( Right paren \)
62 % Asterisk \* Plus \+ Comma \,
63 % Minus \- Point \. Solidus \/
64 % Colon \: Semicolon \; Less than \<
65 % Equals \= Greater than \> Question mark \?
66 % Commercial at \@ Left bracket \[ Backslash \\
67 % Right bracket \] Circumflex \^ Underscore \_
68 % Grave accent \` Left brace \{ Vertical bar \|
69 % Right brace \} Tilde \~}
70 %
71 %
72 % \changes{v0.0.1}{2024/02/25}{Converted to DTX file}
73 % \changes{v1.0.0}{2024/02/27}{First full release}
74 % \changes{v1.2.0}{2025/07/19}{Merge with official catppuccin package}
75 %
76 % \DoNotIndex{\newcommand,\newenvironment,\@ifclassloaded,\def,\renewcommand,\RequirePackage,\setbeamercolor,\usebeamercolor,\ProvidesPackage,\DeclareOptionBeamer,\ExecuteOptionsBeamer,\ProcessOptionsBeamer,\mode}
77 %
78 % \providecommand*{\url}{\texttt}
79 % \GetFileInfo{beamercolorthemecatppuccin.dtx}
80 % \title{The \textsf{beamercolorthemecatppuccin} package}
81 % \author{Lukas Heindl \\ \url{[email protected]} \\ \url{https://github.com/atticus-sullivan/beamercolorthemecatppuccin}}
82 % \date{\fileversion~from \filedate}
83 %
84 % \providecommand\pkg{\textsf}
85 %
86 % \maketitle
87 % \begin{abstract}
88 % The LaTeX package \pkg{beamercolorthemecatppuccinPalette} brings the
89 % catppuccin theme to beamer.
90 % \end{abstract}
91 %
92 % \section{Introduction}
93 %
94 % Catppuccin\footnote{\url{https://github.com/catppuccin/catppuccin}} is a nice
95 % pastel theme in 4 flavours/styles (\emph{Latte}, \emph{Frapp\'e},
96 % \emph{Macchiato}, \emph{Mocha}). This package makes use of the
97 % \verb|catppuccinPalette|\footnote{\url{https://ctan.org/pkg/catppuccinpalette}} package to bring these color
98 % themes to beamer.
99 %
100 % \section{Usage}
101 % Just load the color theme with \verb|\usecolortheme{Catppuccin}| and use
102 % beamer just like usually.
103 %
104 % Note that this package also defines that \verb|\emph| uses the (fg) beamer
105 % color \verb|structure|.
106 %
107 % As this package loads the \verb|catppuccinPalette| package, we provide the
108 % \verb|paletteOpts| package option which is passed to that package (to avoid
109 % option clashes).
110
111 % This package also allows you to set a specific style which sets style of the
112 % color scheme being used via the package option \verb|style|.
113 %
114 % \subsection{Package options}
115 % \begin{tabularx}{\linewidth}{lX}
116 % \emph{Option} & \emph{Description}
117 % \\\toprule
118 % \verb|style| &
119 % set the style of the color scheme being used for beamer. Possible values:
120 % \verb|Latte| (default+initial), \verb|Frappe|, \verb|Mocha|
121 % \\
122 % \verb|paletteOpts| &
123 % pass options to the catppuccinPalette package when loading it
124 % \\
125 % \verb|accent| &
126 % allows setting the accent color being used.
127 % Must be the name of a valid color from the catppuccinpalette (like \verb|Sky|)
128 % \\
129 % \verb|blacktext|\,/\,\verb|whitetext| &
130 % sets the color of normal text to completely white\,/\,black in order to increase the contrast.
131 % \\\bottomrule
132 % \end{tabularx}
133 %
134 % \StopEventually{}
135 %
136 % \section{Implementation}
137 %
138 % \iffalse
139 %<*package>
140 % \fi
141 %
142 % \begin{macrocode}
143 \@ifclassloaded{beamer}{
144 \mode<presentation>
145 \newif\ifbeamer@catppuccintheme@blacktext
146 \newif\ifbeamer@catppuccintheme@whitetext
147 \DeclareOptionBeamer{style}{\def\beamer@catppuccintheme@style{#1}}
148 \DeclareOptionBeamer{accent}{\def\beamer@catppuccintheme@accent{#1}}
149 \DeclareOptionBeamer{blacktext}{\csname beamer@catppuccintheme@blacktext#1\endcsname}
150 \DeclareOptionBeamer{whitetext}{\csname beamer@catppuccintheme@whitetext#1\endcsname}
151 \DeclareOptionBeamer{paletteOpts}{\def\beamer@catppuccintheme@paletteOpts{#1}}
152 \ExecuteOptionsBeamer{style=Latte,paletteOpts=,accent=Green,blacktext=false,whitetext=false} % set default
153 \ProcessOptionsBeamer
154 %
155 \RequirePackage[\beamer@catppuccintheme@paletteOpts]{catppuccinpalette}
156 \setbeamercolor*{structure}{
157 bg=Ctp\beamer@catppuccintheme@style\beamer@catppuccintheme@accent !20,
158 fg=Ctp\beamer@catppuccintheme@style\beamer@catppuccintheme@accent
159 }
160 \ifbeamer@catppuccintheme@blacktext
161 \setbeamercolor*{normal text}{
162 bg=Ctp\beamer@catppuccintheme@style Base,
163 fg=black
164 }
165 \setbeamercolor*{section in toc}{
166 fg=black,
167 bg=Ctp\beamer@catppuccintheme@style Base
168 }
169 \else\ifbeamer@catppuccintheme@blacktext
170 \setbeamercolor*{normal text}{
171 bg=Ctp\beamer@catppuccintheme@style Base,
172 fg=white
173 }
174 \setbeamercolor*{section in toc}{
175 fg=white,
176 bg=Ctp\beamer@catppuccintheme@style Base
177 }
178 \else
179 \setbeamercolor*{normal text}{
180 bg=Ctp\beamer@catppuccintheme@style Base,
181 fg=Ctp\beamer@catppuccintheme@style Text
182 }
183 \setbeamercolor*{section in toc}{
184 fg=Ctp\beamer@catppuccintheme@style Text,
185 bg=Ctp\beamer@catppuccintheme@style Base
186 }
187 \fi\fi
188 \setbeamercolor*{alerted text}{
189 use=structure,
190 fg=structure.fg!80!gray
191 }
192 \setbeamercolor*{palette primary}{
193 use=structure,
194 fg=structure.fg!60!Ctp\beamer@catppuccintheme@style Text,
195 bg=Ctp\beamer@catppuccintheme@style Surface2
196 }
197 \setbeamercolor*{palette secondary}{
198 use=structure,
199 fg=structure.fg!70!Ctp\beamer@catppuccintheme@style Text,
200 bg=Ctp\beamer@catppuccintheme@style Surface1
201 }
202 \setbeamercolor*{palette tertiary}{
203 use=structure,
204 bg=structure.fg!80!Ctp\beamer@catppuccintheme@style Text,
205 fg=Ctp\beamer@catppuccintheme@style Surface0
206 }
207 \setbeamercolor*{palette quaternary}{
208 use=structure,
209 fg=structure.fg,
210 bg=Ctp\beamer@catppuccintheme@style Mantle
211 }
212 \setbeamercolor*{sidebar}{
213 use=structure,
214 fg=structure.fg,
215 bg=Ctp\beamer@catppuccintheme@style Crust
216 }
217 \setbeamercolor*{palette sidebar primary}{
218 use=structure,
219 fg=structure.fg!10!Ctp\beamer@catppuccintheme@style Text
220 }
221 \setbeamercolor*{palette sidebar secondary}{
222 use=structure,
223 fg=structure.fg!20!Ctp\beamer@catppuccintheme@style Text
224 }
225 \setbeamercolor*{palette sidebar tertiary}{
226 use=structure,
227 fg=structure.fg!30!Ctp\beamer@catppuccintheme@style Text
228 }
229 \setbeamercolor*{palette sidebar quaternary}{
230 use=structure,
231 fg=structure.fg!40!Ctp\beamer@catppuccintheme@style Text
232 }
233 \setbeamercolor*{titlelike}{
234 bg=Ctp\beamer@catppuccintheme@style Base,
235 fg=Ctp\beamer@catppuccintheme@style\beamer@catppuccintheme@accent
236 }
237 \setbeamercolor*{frametitle}{
238 bg=gray!10!Ctp\beamer@catppuccintheme@style Base
239 }
240 \setbeamercolor*{frametitle right}{
241 bg=gray!60!Ctp\beamer@catppuccintheme@style Base
242 }
243 \setbeamercolor*{separation line}{}
244 \setbeamercolor*{fine separation line}{}
245 % \end{macrocode}
246 % from orchid
247 % \begin{macrocode}
248 \setbeamercolor{block title}{
249 use=structure,
250 fg=Ctp\beamer@catppuccintheme@style Base,
251 bg=structure.fg!75!Ctp\beamer@catppuccintheme@style Text
252 }
253 \setbeamercolor{block title alerted}{
254 use=alerted text,
255 fg=Ctp\beamer@catppuccintheme@style Base,
256 bg=alerted text.fg!75!Ctp\beamer@catppuccintheme@style Text
257 }
258 \setbeamercolor{block title example}{
259 use=example text,
260 fg=Ctp\beamer@catppuccintheme@style Base,
261 bg=example text.fg!75!Ctp\beamer@catppuccintheme@style Text
262 }
263 \setbeamercolor{block body}{
264 parent=normal text,
265 use=block title,
266 bg=block title.bg!10!bg
267 }
268 \setbeamercolor{block body alerted}{
269 parent=normal text,
270 use=block title alerted,
271 bg=block title alerted.bg!10!bg
272 }
273 \setbeamercolor{block body example}{
274 parent=normal text,
275 use=block title example,
276 bg=block title example.bg!10!bg
277 }
278 % \end{macrocode}
279 %
280 % \begin{macro}{\emph}
281 % Redefine emph to use the color defined in beamer
282 % \begin{macrocode}
283 \renewcommand{\emph}[1]{{\usebeamercolor[fg]{structure}#1}}
284 % \end{macrocode}
285 % \end{macro}
286 % close if beamer loaded
287 % \begin{macrocode}
288 \mode<all>
289 }
290 % \end{macrocode}
291
292 %
293 % \iffalse
294 %</package>
295 % \fi
296 %
297 % \Finale
298 \endinput