-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlatex.tera
368 lines (364 loc) · 15.3 KB
/
latex.tera
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
---
whiskers:
version: 2.5.1
filename: "catppuccinpalette.dtx"
packageVersion: 1.1.0
versionDate:
year: 2024
month: 08
day: 13
---
% \iffalse meta-comment
%
{{ read_file(path="LICENSE") | indent(prefix="% ", first=true, blank=true) }}
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{catppuccinpalette.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{catppuccinpalette}
%<*package>
[{{versionDate.year}}/{{versionDate.month}}/{{versionDate.day}} v{{ packageVersion }} catppuccin xcolor palette]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{catppuccinpalette}
\usepackage{multicol}
\usepackage{pgffor}
\usepackage{tabularx, booktabs}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{catppuccinpalette.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{111}
%
% \CharacterTable
% {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
% 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
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
%
% \changes{v0.0.1}{2024/02/09}{Converted to DTX file}
% \changes{v1.0.0}{2024/02/27}{First full release}
% \changes{v1.0.1}{2024/05/19}{Make fit for CTAN}
% \changes{v1.0.2}{2024/05/19}{Fix colors in documentation}
% \changes{v1.1.0}{2024/08/13}{Move to / Merge with official catppuccin. Thereby deprecate colors with |Cat| prefix. Subject to removal in the future}
%
% \DoNotIndex{\newcommand,\newenvironment,\color,\colorlet,\def,\fi,\RequirePackage,\ProvidesPackage,\ProcessPgfOptions,\preparecolorset,\pgfkeys,\pagecolor,\newif,\NeedsTeXFormat}
%
% \providecommand*\pkg{\textsf}
% \providecommand*{\url}{\texttt}
% \GetFileInfo{catppuccinpalette.dtx}
% \title{The \textsf{catppuccinPalette} package}
% {{ '\author{Lukas Heindl \\ \url{[email protected]} \\ \url{https://github.com/catppuccin/latex}}' }}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
% \begin{abstract}
% The LaTeX package \pkg{catppuccinPalette} provides new colors for xcolor.
% \end{abstract}
%
% \section{Introduction}
%
% {{ 'Catppuccin\footnote{\url{https://github.com/catppuccin/catppuccin}} is a soothing' }}
% pastel theme in 4 flavours/styles (\emph{Latte}, \emph{Frapp\'e},
% \emph{Macchiato}, \emph{Mocha}). This package defines these themes as xcolor
% colors.
%
% \section{Usage}
%
% Load via |\usepackage{catppuccinpalette}|
%
% Just use the new colors (prefixed with \verb|Ctp<Style>|) like normal xcolors.
% In addition to the usual colors of the palette, this package defines some
% colors according to the
% {{ 'style guide\footnote{\url{https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md}}' }}
% for ease of use.
%
% This package also allows you to set a specific style which sets the shortened
% color names (prefixed only with \verb|Ctp|) to the selected style (allows for
% easy switching style) via the package option \verb|style|.
%
% This package loads xcolor (without options) so if you want to set some xcolor
% options you should load xcolor before loading this package.
%
% \subsection{Package options}
% \begin{tabularx}{\linewidth}{lX}
% \emph{Option} & \emph{Description}
% \\\toprule
% \verb|style| &
% set the style used by the shortened prefix (\verb|Ctp|). Possible values:
% \verb|Latte| (default+initial), \verb|latte|, \verb|Frappe|, \verb|frappe|,
% \verb|Mocha|, \verb|mocha|, \verb|Macchiato|, \verb|macchiato|
% \\
% &
% As a shortcut, you can also just use e.\,g.\,
% |\usepackage[latte]{catppuccinPalette}| as a shorthand for
% |\usepackage[style=latte]{catppuccinPalette}|
% \\
% \verb|textcolor| &
% set the default textcolor of the document to \verb|CtpText|. Possible values:
% \verb|false| (initial), \verb|true| (default)
% \\
% \verb|pagecolor| &
% set the pagecolor of the document to \verb|CtpBackground|. Possible values:
% \verb|false| (initial), \verb|true| (default)
% \\
% \verb|hyperref| &
% style hyperref according to the style guide\footnote{\url{https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md\#typography}}.
% Possible values: \verb|false| (initial), \verb|true| (default)
% \newline
% \textbf{Note:} in order to make this work, \verb|catppuccinpalette| needs to
% be loaded \emph{before} the \verb|hyperref| package.
% \\\midrule
% \verb|styleAll| &
% shortcut for setting \verb|pagecolor|, \verb|textcolor| and \verb|hyperref|
% \\\bottomrule
% \end{tabularx}
%
% \subsubsection{Change settings mid-document}
% \DescribeMacro{\CtpReinit} |\CtpReinit[opts]|
%
% This command allows to reinitialize this package. All previous configuration
% options will be kept. In particular this allows to change the active
% style/flavor mid-document. Note that if you decided this package should
% change the background color when loading the package and only do
% |\CptReinit[style=<another style>]|, then the background color will also be
% adjusted on reinitialization.
%
% The command processes the same options like the ones you can pass when
% loading the package (see documentation above).
%
% \subsection{Colors}
% \textbf{Note:} The colors with the prefix |Cat| are deprecated and will be removed in a future version!
% {{ '\newcommand{\showCol}[1]{\raisebox{0.5ex}{\fcolorbox{black}{#1}{\hspace{1em}}} #1}' }}
{% for _, flavor in flavors %}{{ '% \subsubsection{Style \texttt{'}}{{ flavor.identifier | capitalize }}{{'}}' }}
% \begin{multicols}{2}{% for _, color in flavor.colors %}
% \showCol{Ctp{{ flavor.identifier | capitalize }}{{ color.identifier | capitalize }}}\par{% endfor %}
% \end{multicols}
% Some basic colors according to the style guide:
% \begin{multicols}{2}
% \showCol{Ctp{{ flavor.identifier | capitalize }}Background}\par
% \showCol{Ctp{{ flavor.identifier | capitalize }}Link}\par
% \phantom{}\par
% \columnbreak
% \showCol{Ctp{{ flavor.identifier | capitalize }}Success}\par
% \showCol{Ctp{{ flavor.identifier | capitalize }}Warning}\par
% \showCol{Ctp{{ flavor.identifier | capitalize }}Error}\par
% \end{multicols}
{% endfor %}
%
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\RequirePackage{pgfopts}
\RequirePackage{xcolor}
% \end{macrocode}
% Define the conditionals used by package options
% \begin{macrocode}
\newif\ifcatppuccinpalette@pagecolor
\newif\ifcatppuccinpalette@textcolor
\newif\ifcatppuccinpalette@hyperref
\pgfkeys{
/catppuccinPalette/.cd,
% \end{macrocode}
% Define the package option keys
% \begin{macrocode}
Latte/.style={style=Latte},
latte/.style={style=Latte},
Frappe/.style={style=Frappe},
frappe/.style={style=Frappe},
Macchiato/.style={style=Macchiato},
macchiato/.style={style=Macchiato},
Mocha/.style={style=Mocha},
mocha/.style={style=Mocha},
style/.is choice,
style/.value required,
{{ 'style/Latte/.code = {\def\catppuccinpalette@style{Latte}},' }}
style/latte/.style = {style=Latte},
{{ 'style/Frappe/.code = {\def\catppuccinpalette@style{Frappe}},' }}
style/frappe/.style = {style=Frappe},
{{ 'style/Macchiato/.code = {\def\catppuccinpalette@style{Macchiato}},' }}
style/macchiato/.style = {style=Macchiato},
{{ 'style/Mocha/.code = {\def\catppuccinpalette@style{Mocha}},' }}
style/mocha/.style = {style=Mocha},
textcolor/.is if = catppuccinpalette@textcolor,
textcolor/.default = true,
hyperref/.is if = catppuccinpalette@hyperref,
hyperref/.default = true,
pagecolor/.is if = catppuccinpalette@pagecolor,
pagecolor/.default = true,
styleAll/.style = {pagecolor,textcolor,hyperref},
% \end{macrocode}
% Set initial values for all options
% \begin{macrocode}
textcolor = false,
hyperref = false,
pagecolor = false,
style = Latte,
}
\ProcessPgfOptions{catppuccinPalette}
% \end{macrocode}
{% for _, flavor in flavors %}
{{ '% Define the \emph{' }}{{ flavor.identifier | capitalize }}{{ '} colorset' }}
% \begin{macrocode}
{{ '\preparecolorset{RGB/HTML}{Cat' }}{{ flavor.identifier | capitalize }}{{ '}{}{%' }}{% for _, color in flavor.colors %}
{{ color.identifier | capitalize }},{{ color.rgb.r }},{{ color.rgb.g }},{{ color.rgb.b }}/{{ color.hex | upper }}{% if not loop.last %};{% endif %}%{% endfor %}
}
{{ '\colorlet{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Background}{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Base}' }}
{{ '\colorlet{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Link}{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Blue}' }}
{{ '\colorlet{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Success}{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Green}' }}
{{ '\colorlet{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Warning}{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Yellow}' }}
{{ '\colorlet{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Error}{Cat' }}{{ flavor.identifier | capitalize }}{{ 'Red}' }}
{{ '\preparecolorset{RGB/HTML}{Ctp' }}{{ flavor.identifier | capitalize }}{{ '}{}{%' }}{% for _, color in flavor.colors %}
{{ color.identifier | capitalize }},{{ color.rgb.r }},{{ color.rgb.g }},{{ color.rgb.b }}/{{ color.hex | upper }}{% if not loop.last %};{% endif %}%{% endfor %}
}
% \end{macrocode}
% Define colors according to the catppuccin style guide
% \begin{macrocode}
{{ '\colorlet{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Background}{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Base}' }}
{{ '\colorlet{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Link}{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Blue}' }}
{{ '\colorlet{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Success}{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Green}' }}
{{ '\colorlet{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Warning}{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Yellow}' }}
{{ '\colorlet{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Error}{Ctp' }}{{ flavor.identifier | capitalize }}{{ 'Red}' }}
% \end{macrocode}
{% endfor %}
% Define shortcuts for active style (legacy part)
% \begin{macrocode}
\colorlet{CatRosewater}{Ctp\catppuccinpalette@style Rosewater}
\colorlet{CatFlamingo}{Ctp\catppuccinpalette@style Flamingo}
\colorlet{CatPink}{Ctp\catppuccinpalette@style Pink}
\colorlet{CatMauve}{Ctp\catppuccinpalette@style Mauve}
\colorlet{CatRed}{Ctp\catppuccinpalette@style Red}
\colorlet{CatMaroon}{Ctp\catppuccinpalette@style Maroon}
\colorlet{CatPeach}{Ctp\catppuccinpalette@style Peach}
\colorlet{CatYellow}{Ctp\catppuccinpalette@style Yellow}
\colorlet{CatGreen}{Ctp\catppuccinpalette@style Green}
\colorlet{CatTeal}{Ctp\catppuccinpalette@style Teal}
\colorlet{CatSky}{Ctp\catppuccinpalette@style Sky}
\colorlet{CatSapphire}{Ctp\catppuccinpalette@style Sapphire}
\colorlet{CatBlue}{Ctp\catppuccinpalette@style Blue}
\colorlet{CatLavender}{Ctp\catppuccinpalette@style Lavender}
\colorlet{CatText}{Ctp\catppuccinpalette@style Text}
\colorlet{CatSubtext1}{Ctp\catppuccinpalette@style Subtext1}
\colorlet{CatSubtext0}{Ctp\catppuccinpalette@style Subtext0}
\colorlet{CatOverlay2}{Ctp\catppuccinpalette@style Overlay2}
\colorlet{CatOverlay1}{Ctp\catppuccinpalette@style Overlay1}
\colorlet{CatOverlay0}{Ctp\catppuccinpalette@style Overlay0}
\colorlet{CatSurface2}{Ctp\catppuccinpalette@style Surface2}
\colorlet{CatSurface1}{Ctp\catppuccinpalette@style Surface1}
\colorlet{CatSurface0}{Ctp\catppuccinpalette@style Surface0}
\colorlet{CatBase}{Ctp\catppuccinpalette@style Base}
\colorlet{CatMantle}{Ctp\catppuccinpalette@style Mantle}
\colorlet{CatCrust}{Ctp\catppuccinpalette@style Crust}
\colorlet{CatBackground}{Ctp\catppuccinpalette@style Base}
\colorlet{CatLink}{Ctp\catppuccinpalette@style Blue}
\colorlet{CatSuccess}{Ctp\catppuccinpalette@style Green}
\colorlet{CatWarning}{Ctp\catppuccinpalette@style Yellow}
\colorlet{CatError}{Ctp\catppuccinpalette@style Red}
% \end{macrocode}
% New command which parses the same options like the package. Can be used to e.\,g.\, reset/reinit the selected style.
% \begin{macrocode}
{{ '\NewDocumentCommand\CtpReinit{O{}}{%' }}
{{ '\pgfkeys{%' }}
/catppuccinPalette/.cd,%
#1%
}%
% \end{macrocode}
% Define shortcuts for active style
% \begin{macrocode}
\colorlet{CtpRosewater}{Ctp\catppuccinpalette@style Rosewater}%
\colorlet{CtpFlamingo}{Ctp\catppuccinpalette@style Flamingo}%
\colorlet{CtpPink}{Ctp\catppuccinpalette@style Pink}%
\colorlet{CtpMauve}{Ctp\catppuccinpalette@style Mauve}%
\colorlet{CtpRed}{Ctp\catppuccinpalette@style Red}%
\colorlet{CtpMaroon}{Ctp\catppuccinpalette@style Maroon}%
\colorlet{CtpPeach}{Ctp\catppuccinpalette@style Peach}%
\colorlet{CtpYellow}{Ctp\catppuccinpalette@style Yellow}%
\colorlet{CtpGreen}{Ctp\catppuccinpalette@style Green}%
\colorlet{CtpTeal}{Ctp\catppuccinpalette@style Teal}%
\colorlet{CtpSky}{Ctp\catppuccinpalette@style Sky}%
\colorlet{CtpSapphire}{Ctp\catppuccinpalette@style Sapphire}%
\colorlet{CtpBlue}{Ctp\catppuccinpalette@style Blue}%
\colorlet{CtpLavender}{Ctp\catppuccinpalette@style Lavender}%
\colorlet{CtpText}{Ctp\catppuccinpalette@style Text}%
\colorlet{CtpSubtext1}{Ctp\catppuccinpalette@style Subtext1}%
\colorlet{CtpSubtext0}{Ctp\catppuccinpalette@style Subtext0}%
\colorlet{CtpOverlay2}{Ctp\catppuccinpalette@style Overlay2}%
\colorlet{CtpOverlay1}{Ctp\catppuccinpalette@style Overlay1}%
\colorlet{CtpOverlay0}{Ctp\catppuccinpalette@style Overlay0}%
\colorlet{CtpSurface2}{Ctp\catppuccinpalette@style Surface2}%
\colorlet{CtpSurface1}{Ctp\catppuccinpalette@style Surface1}%
\colorlet{CtpSurface0}{Ctp\catppuccinpalette@style Surface0}%
\colorlet{CtpBase}{Ctp\catppuccinpalette@style Base}%
\colorlet{CtpMantle}{Ctp\catppuccinpalette@style Mantle}%
\colorlet{CtpCrust}{Ctp\catppuccinpalette@style Crust}%
\colorlet{CtpBackground}{Ctp\catppuccinpalette@style Base}%
\colorlet{CtpLink}{Ctp\catppuccinpalette@style Blue}%
\colorlet{CtpSuccess}{Ctp\catppuccinpalette@style Green}%
\colorlet{CtpWarning}{Ctp\catppuccinpalette@style Yellow}%
\colorlet{CtpError}{Ctp\catppuccinpalette@style Red}%
% \end{macrocode}
% Set pagecolor according to the style guide if the user wants this
% \begin{macrocode}
\ifcatppuccinpalette@pagecolor%
\pagecolor{CtpBackground}%
\fi%
% \end{macrocode}
% Set textcolor according to the style guide if the user wants this
% \begin{macrocode}
\ifcatppuccinpalette@textcolor%
\color{CtpText}%
\fi%
% \end{macrocode}
% Style hyerref according to the styleguide\footnote{\url{https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md\#typography}} if the user wants it
% \begin{macrocode}
\ifcatppuccinpalette@hyperref%
\PassOptionsToPackage{
linkcolor=CtpBlue,citecolor=CtpGreen,filecolor=CtpSky,menucolor=CtpBlue,runcolor=CtpSky,urlcolor=CtpSapphire,%
linkbordercolor=CtpBlue,citebordercolor=CtpGreen,filebordercolor=CtpSky,menubordercolor=CtpBlue,runbordercolor=CtpSky,urlbordercolor=CtpSapphire,%
}{hyperref}%
\fi%
% \end{macrocode}
% \begin{macrocode}
}
\CtpReinit[]
% \end{macrocode}
\endinput
%
% \iffalse
%</package>
% \fi
%
% \Finale
\endinput