Skip to content

Commit

Permalink
feat: add option to style hyperref (#19)
Browse files Browse the repository at this point in the history
* feat: add option to style hyperref

* forgot to make the changes to latex.tera. sync them again

* Note about loading before hyperref

* also adjust the border colors

* adjust examples/assets to include hyperref example

* use sapphire for urls

* fixup tera file
  • Loading branch information
atticus-sullivan authored Jan 28, 2025
1 parent 752dfd6 commit 6730743
Show file tree
Hide file tree
Showing 21 changed files with 196 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ build/
*.fdb_latexmk
*.fls
*.log
*.out
*.synctex.gz
Binary file modified assets/frappe.webp
Binary file not shown.
Binary file modified assets/latte.webp
Binary file not shown.
Binary file modified assets/macchiato.webp
Binary file not shown.
Binary file modified assets/mocha.webp
Binary file not shown.
Binary file modified assets/preview.webp
Binary file not shown.
24 changes: 22 additions & 2 deletions catppuccinpalette.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,16 @@
% \verb|pagecolor| &
% set the pagecolor of the document to \verb|CtpBackground|. Possible values:
% \verb|false| (default+initial), \verb|true|
% \\
% \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| and \verb|textcolor|
% shortcut for setting \verb|pagecolor|, \verb|textcolor| and \verb|hyperref|
% \\\bottomrule
% \end{tabularx}
%
Expand Down Expand Up @@ -333,6 +340,7 @@
% \begin{macrocode}
\newif\ifcatppuccinpalette@pagecolor
\newif\ifcatppuccinpalette@textcolor
\newif\ifcatppuccinpalette@hyperref
\pgfkeys{
/catppuccinPalette/.cd,
% \end{macrocode}
Expand All @@ -358,13 +366,16 @@
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},
styleAll/.style = {pagecolor,textcolor,hyperref},
% \end{macrocode}
% Set initial values for all options
% \begin{macrocode}
textcolor = false,
hyperref = false,
pagecolor = false,
style = Latte,
}
Expand Down Expand Up @@ -756,6 +767,15 @@
\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[]
Expand Down
Binary file modified catppuccinpalette.pdf
Binary file not shown.
Binary file modified examples/frappe.pdf
Binary file not shown.
78 changes: 52 additions & 26 deletions examples/frappe.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\documentclass[12pt]{article}
\documentclass[12pt,a4paper]{article}

% Imports the catppuccin theme, using the frappe flavor,
% from the directory above. Actual implementation
Expand All @@ -7,6 +7,8 @@
\usepackage{import}
\usepackage[frappe,styleAll]{catppuccinpalette}

\usepackage{hyperref}

% Removes padding above title
\usepackage{titling}
\setlength{\droptitle}{-10em}
Expand All @@ -23,25 +25,25 @@
% Add code highlighting specific for my Ruby on Rails snippet
% You'd want to follow something similar below to add your own keyword highlighting
\lstdefinestyle{ruby_on_rails}{
language={Ruby},
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
stringstyle = {\color{CtpGreen}},
commentstyle={\color{CtpOverlay1}},
basicstyle = {\small\color{CtpText}\ttfamily},
keywordstyle = {\color{CtpMauve}},
keywordstyle = [2]{\color{CtpBlue}},
keywordstyle = [3]{\color{CtpYellow}},
keywordstyle = [4]{\color{CtpLavender}},
keywordstyle = [5]{\color{CtpPeach}},
keywordstyle = [6]{\color{CtpTeal}},
otherkeywords = {<, ||, =, ?},
morekeywords = [2]{new, create, present, email, description, creator, protect_from_forgery, before_action},
morekeywords = [3]{PageController, ApplicationController, Page},
morekeywords = [4]{@page},
morekeywords = [5]{exception, do_some_for_pages, @page, @admin},
morekeywords = [6]{<, ||, =, ?},
language={Ruby},
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
stringstyle = {\color{CtpGreen}},
commentstyle={\color{CtpOverlay1}},
basicstyle = {\footnotesize\color{CtpText}\ttfamily},
keywordstyle = {\color{CtpMauve}},
keywordstyle = [2]{\color{CtpBlue}},
keywordstyle = [3]{\color{CtpYellow}},
keywordstyle = [4]{\color{CtpLavender}},
keywordstyle = [5]{\color{CtpPeach}},
keywordstyle = [6]{\color{CtpTeal}},
otherkeywords = {<, ||, =, ?},
morekeywords = [2]{new, create, present, email, description, creator, protect_from_forgery, before_action},
morekeywords = [3]{PageController, ApplicationController, Page},
morekeywords = [4]{@page},
morekeywords = [5]{exception, do_some_for_pages, @page, @admin},
morekeywords = [6]{<, ||, =, ?},
}

% Set the title and author, utilizing CtpPink
Expand All @@ -55,17 +57,41 @@

\section{\textcolor{CtpSky}{Simple Paragraph}}
\textcolor{CtpYellow}{This is what a simple paragraph looks like.} You can see that all the colors in this pallet complement each other and maintain an elegance all within the same proximity. The default text color is called \textbf{\textcolor{CtpGreen}{CtpText}} while the background color is called \textbf{\textcolor{CtpGreen}{CtpBase}}.
\\

\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Hyperref}}
(internal) Link: \pageref{l}

Citation: \cite{bb}

File: \href{file:///home/second_user}{goto file}

Menu: Only in Acrobat menu items

Run: no idea where this color is used

Url: \url{https://github.com}

\section{\textcolor{CtpSky}{Math}}
\label{l}
\begin{thebibliography}{2}
\bibitem{bb} example bib item.
\end{thebibliography}
\end{minipage}
\hfill\vline\hfill
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Math}}

You even can make math formulas, equations, and examples look nicer and more legible:
You even can make math formulas, equations, and examples look nicer and more legible:


\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]
\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]

\tiny{(Or just color dump like I did)}
\tiny{(Or just color dump like I did)}
\end{minipage}
\\

\section{\textcolor{CtpSky}{Code Snippets}}

Expand Down
Binary file modified examples/frappe.webp
Binary file not shown.
Binary file modified examples/latte.pdf
Binary file not shown.
41 changes: 33 additions & 8 deletions examples/latte.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\documentclass[12pt]{article}
\documentclass[12pt,a4paper]{article}

% Imports the catppuccin theme, using the latte flavor,
% from the directory above. Actual implementation
Expand All @@ -7,6 +7,8 @@
\usepackage{import}
\usepackage[latte,styleAll]{catppuccinPalette}

\usepackage{hyperref}

% Removes padding above title
\usepackage{titling}
\setlength{\droptitle}{-10em}
Expand All @@ -29,7 +31,7 @@
breakatwhitespace=true,
stringstyle = {\color{CtpGreen}},
commentstyle={\color{CtpOverlay1}},
basicstyle = {\small\color{CtpText}\ttfamily},
basicstyle = {\footnotesize\color{CtpText}\ttfamily},
keywordstyle = {\color{CtpMauve}},
keywordstyle = [2]{\color{CtpBlue}},
keywordstyle = [3]{\color{CtpYellow}},
Expand All @@ -56,16 +58,39 @@
\section{\textcolor{CtpSky}{Simple Paragraph}}
\textcolor{CtpYellow}{This is what a simple paragraph looks like.} You can see that all the colors in this pallet complement each other and maintain an elegance all within the same proximity. The default text color is called \textbf{\textcolor{CtpGreen}{CtpText}} while the background color is called \textbf{\textcolor{CtpGreen}{CtpBase}}.

\section{\textcolor{CtpSky}{Math}}
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Hyperref}}
(internal) Link: \pageref{l}

Citation: \cite{bb}

File: \href{file:///home/second_user}{goto file}

Menu: Only in Acrobat menu items

Run: no idea where this color is used

Url: \url{https://github.com}

\label{l}
\begin{thebibliography}{2}
\bibitem{bb} example bib item.
\end{thebibliography}
\end{minipage}
\hfill\vline\hfill
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Math}}

You even can make math formulas, equations, and examples look nicer and more legible:
You even can make math formulas, equations, and examples look nicer and more legible:


\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]
\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]

\tiny{(Or just color dump like I did)}
\tiny{(Or just color dump like I did)}
\end{minipage}
\\

\section{\textcolor{CtpSky}{Code Snippets}}

Expand Down
Binary file modified examples/latte.webp
Binary file not shown.
Binary file modified examples/macchiato.pdf
Binary file not shown.
41 changes: 33 additions & 8 deletions examples/macchiato.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\documentclass[12pt]{article}
\documentclass[12pt,a4paper]{article}

% Imports the catppuccin theme, using the macchiato flavor,
% from the directory above. Actual implementation
Expand All @@ -7,6 +7,8 @@
\usepackage{import}
\usepackage[macchiato,styleAll]{catppuccinPalette}

\usepackage{hyperref}

% Removes padding above title
\usepackage{titling}
\setlength{\droptitle}{-10em}
Expand All @@ -29,7 +31,7 @@
breakatwhitespace=true,
stringstyle = {\color{CtpGreen}},
commentstyle={\color{CtpOverlay1}},
basicstyle = {\small\color{CtpText}\ttfamily},
basicstyle = {\footnotesize\color{CtpText}\ttfamily},
keywordstyle = {\color{CtpMauve}},
keywordstyle = [2]{\color{CtpBlue}},
keywordstyle = [3]{\color{CtpYellow}},
Expand All @@ -56,16 +58,39 @@
\section{\textcolor{CtpSky}{Simple Paragraph}}
\textcolor{CtpYellow}{This is what a simple paragraph looks like.} You can see that all the colors in this pallet complement each other and maintain an elegance all within the same proximity. The default text color is called \textbf{\textcolor{CtpGreen}{CtpText}} while the background color is called \textbf{\textcolor{CtpGreen}{CtpBase}}.

\section{\textcolor{CtpSky}{Math}}
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Hyperref}}
(internal) Link: \pageref{l}

Citation: \cite{bb}

File: \href{file:///home/second_user}{goto file}

Menu: Only in Acrobat menu items

Run: no idea where this color is used

Url: \url{https://github.com}

\label{l}
\begin{thebibliography}{2}
\bibitem{bb} example bib item.
\end{thebibliography}
\end{minipage}
\hfill\vline\hfill
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Math}}

You even can make math formulas, equations, and examples look nicer and more legible:
You even can make math formulas, equations, and examples look nicer and more legible:


\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]
\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]

\tiny{(Or just color dump like I did)}
\tiny{(Or just color dump like I did)}
\end{minipage}
\\

\section{\textcolor{CtpSky}{Code Snippets}}

Expand Down
Binary file modified examples/macchiato.webp
Binary file not shown.
Binary file modified examples/mocha.pdf
Binary file not shown.
41 changes: 33 additions & 8 deletions examples/mocha.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\documentclass[12pt]{article}
\documentclass[12pt,a4paper]{article}

% Imports the catppuccin theme, using the mocha flavor,
% from the directory above. Actual implementation
Expand All @@ -7,6 +7,8 @@
\usepackage{import}
\usepackage[mocha,styleAll]{catppuccinPalette}

\usepackage{hyperref}

% Removes padding above title
\usepackage{titling}
\setlength{\droptitle}{-10em}
Expand All @@ -29,7 +31,7 @@
breakatwhitespace=true,
stringstyle = {\color{CtpGreen}},
commentstyle={\color{CtpOverlay1}},
basicstyle = {\small\color{CtpText}\ttfamily},
basicstyle = {\footnotesize\color{CtpText}\ttfamily},
keywordstyle = {\color{CtpMauve}},
keywordstyle = [2]{\color{CtpBlue}},
keywordstyle = [3]{\color{CtpYellow}},
Expand All @@ -56,16 +58,39 @@
\section{\textcolor{CtpSky}{Simple Paragraph}}
\textcolor{CtpYellow}{This is what a simple paragraph looks like.} You can see that all the colors in this pallet complement each other and maintain an elegance all within the same proximity. The default text color is called \textbf{\textcolor{CtpGreen}{CtpText}} while the background color is called \textbf{\textcolor{CtpGreen}{CtpBase}}.

\section{\textcolor{CtpSky}{Math}}
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Hyperref}}
(internal) Link: \pageref{l}

Citation: \cite{bb}

File: \href{file:///home/second_user}{goto file}

Menu: Only in Acrobat menu items

Run: no idea where this color is used

Url: \url{https://github.com}

\label{l}
\begin{thebibliography}{2}
\bibitem{bb} example bib item.
\end{thebibliography}
\end{minipage}
\hfill\vline\hfill
\begin{minipage}{0.47\linewidth}
\section{\textcolor{CtpSky}{Math}}

You even can make math formulas, equations, and examples look nicer and more legible:
You even can make math formulas, equations, and examples look nicer and more legible:


\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]
\[\large{
\textcolor{CtpBlue}{\lim_{{n \to \infty}} \textcolor{CtpPeach}{\int_{\textcolor{CtpRed}{a}}^{\textcolor{CtpRed}{b}} \frac{\textcolor{CtpGreen}{\sin}(\textcolor{CtpYellow}{nx})}{\textcolor{CtpYellow}{x}} \, \textcolor{CtpTeal}{dx}}}
}\]

\tiny{(Or just color dump like I did)}
\tiny{(Or just color dump like I did)}
\end{minipage}
\\

\section{\textcolor{CtpSky}{Code Snippets}}

Expand Down
Binary file modified examples/mocha.webp
Binary file not shown.
Loading

0 comments on commit 6730743

Please sign in to comment.