Fonts and colors customization
Sometimes, you may want to use a built-in theme, but customize the fonts and colors used in your presentation to match your branding or personal preferences. Slydekit allows you to easily override the default fonts and colors by providing your own definitions.
Fonts
To use a custom font set, you have to provide to slydekit a fonts argument with a dictionary containing the following keys:
size – default: “20pt”Size of the main text in the presentation.
body – default: “New Computer Modern”Font family for the main text in the presentation.
math – default: “New Computer Modern Math”Font family for mathematical symbols and equations in the presentation.
raw – default: “DejaVu Sans Mono”Font family for raw text, such as code snippets or monospaced text.
Let’s say you want to use the “Lete Sans Math” font for mathematical symbols and equations, and “Roboto” or “Cascadia Code” (depending on the font availability) for raw text, with a font size of 25pt. You can define your custom fonts as follows:
#let my-fonts = (
size: 25pt,
math: "Lete Sans Math",
raw: ("Roboto", "Cascadia Code")
)Then, you can apply these custom fonts to your presentation by passing the my-fonts dictionary to the slydekit function:
#show: slydekit.with(
fonts: my-fonts,
)It is not necessary to provide all the keys in the fonts dictionary. If you only want to change the font for mathematical symbols, you can just provide the math key, and the other fonts will remain as their default values.
You can extend the fonts dictionary with additional keys, but they will not be used by the slydekit function. The only keys that are recognized are size, body, math, and raw. However, you can use the sk-states.fonts state to store additional font information and use it in your custom themes or styles.
Colors
The colors cusotmization works similarly to the fonts customization. You can provide a colors argument to the slydekit function with a dictionary containing the following keys:
primaryPrimary color of the presentation.
secondarySecondary color.
focusBackground color of the focus slide.
backgroundBackground color of the slides.
headerColor of the header.
footerColor of the footer.
Let’s say you want to use a different primary color, a light gray background, and a dark gray footer. You can define your custom colors as follows:
#let my-colors = (
primary: rgb("#FF5733"),
background: rgb("#F0F0F0"),
footer: rgb("#333333")
)Then, you can apply these custom colors to your presentation by passing the my-colors dictionary to the slydekit function:
#show: slydekit.with(
colors: my-colors,
)While the fonts dictionary has a default set of fonts, that are applied during the slidekit initialization, the colors dictionary does not have a default set of colors. If you do not provide a colors argument to the slydekit function, no colors will be applied.
This is a deliberate design choice, as it allows you to have a clean slate for your color customization. You can define your own color scheme without being constrained by a predefined set of colors.