Themes

Themes #

Themes are dictionaries with particular variables that control overall styling of the generated boxes. The dictionary is saved as a state variable and can be accessed by the update-theme and set-theme methods. Most of the time, themes are meant to be set initially without any further alteration.

theme = (
    "body-box-args": dictionary,
    "body-box-args-with-title": dictionary,
    "body-box-function": function,
    "heading-box-args": dictionary,
    "heading-box-args-with-body": dictionary,
    "heading-box-function": function,
)
ArgumentTypeDefault ValueDescription
body-box-argsdictionaryArguments given to the body box.
body-box-args-with-titledictionaryArguments given to the body box when a title is present. This dictionary is optional. Leaving
body-box-functionfunctionArguments given to the body box.
body-text-argsdictionaryText-related arguments given to the body box.
heading-box-argsdictionaryArguments given to the heading box.
heading-box-args-with-bodydictionaryArguments given to the body box.
heading-box-functionfunctionFuctions given to the heading box.
heading-text-argsdictionaryText-related arguments given to the heading box.

heading-text-args & body-text-args #

Takes arguments to alter heading or body text. for all possible arguments see: Text

"heading-text-args": (
    fill: rgb("#FFFFFF"),
    font: "Lora",
)

This would ensure the heading text color is white (#FFFFFF) and the font family is set to ‘Lora’.

"body-text-args": (
    font: ("Ubuntu", "Source Han Sans"),
)

This would set body font family to Ubuntu with Source Han Sans as fallback.

Updating a Theme #

update-theme(
    ..args
)

All arguments coincide with the values of the ones of theme shown above.

Note: Updating in the middle of the document #

The user can also update the theme in the middle of the document. This will alter all following boxes but should not touch preceding ones.

Setting a new Theme #

To entirely change the theme of a document, one can use this method and set the new theme. It is not checked that all keys and values are properly populated. Thus the user is responsible for defining them. It is often easier to instead take an existing theme and modify its entries.

set-theme(
    theme: dictionary
)

Example Themes #

Default #

The default values of the theme. If nothing is specified by the user, these values will be chosen.

default = (
    "body-box-args": (
        inset: 0.6em,
        width: 100%,
    ),
    "body-text-args": (:),
    "heading-box-args": (
        inset: 0.6em,
        width: 100%,
        fill: rgb(50, 50, 50),
        stroke: rgb(25, 25, 25),
    ),
    "heading-text-args": (
        fill: white,
    )
)

Uni Freiburg #

A theme surrounding colors specifically chosen in complience with the corporate design of the University of Freiburg.

#let uni-fr = (
    "body-box-args": (
        inset: 0.6em,
        width: 100%,
    ),
    "body-text-args": (:),
    "heading-box-args": (
        inset: 0.6em,
        width: 100%,
        fill: rgb("#1d154d"),
        stroke: rgb("#1d154d"),
    ),
    "heading-text-args": (
        fill: white,
    ),
)