Touying: Dark theme?

How can I switch to a dark theme in Touying. Currently I’m using university.

If there is no whole-sale “dark theme”, how can I set the background and foreground colors? I looked at the documentation of the university theme, but I didn’t find a mention to background color.

This is the same problem I faced recently when I wanted to quickly create a presentation for a talk at UNIR with a dark color scheme (for A paper about Typst, written in Typst, and with an official Typst-based template in the IJIMAI journal). I basically reversed the colors, but, IIRC, I also had to change some colors etc. in the template to make it actually work. I think there was an issue with a header? I don’t have a diff of the changes in that file in the repo. I mainly had to create a plain-slide function, so the rest is mostly unchanged.

Yeah, the header text uses the same color as the slide background, which means you can’t have opposite/different text color in the header.

So, I think not all templates can have dark theme, especially if they use, e.g., hard-coded colors. You’d have to manually test/check each theme though, I guess.

1 Like

Thanks, but my question seems to be much more basic than yours: I simply don’t know how to make the background dark. The following code produces slides with white background:

#import "@preview/touying:0.6.2": *
#import themes.university: *
#show: university-theme.with(
  aspect-ratio: "16-9",
  config-info(
    title: [My Title],
    subtitle: [My Subtitle],
    author: [A. U. Thor],
    date: datetime.today(),
    institution: [Inst Itu Tion],
    logo: emoji.school,
  ),
  config-page(margin: (top: 3em)),
  config-colors(
      neutral-lightest: black.lighten(10%),
      neutral-darkest: white,
      secondary: rgb("#239dad"),
      primary: green.darken(20%),
      primary-light: green.lighten(60%),
    ),
)

#title-slide()

= Section 1
== Slide Title
slide contents.

I stole the config-colors section from @Andrew’s code.

Is neutral-darkest supposed to mean the background color?

Then I think the most direct solution would be to simply use page fill.

#set page(fill: black)
#set text(fill: white)

Unlike metropolis, university doesn’t set config-page(fill: self.colors.neutral-lightest) in title-slide, it only sets margins, it seems. So, I don’t think there is a way to set background only once, if the template doesn’t use config-colors. But since the template doesn’t set the background color at all, you can do it manually with the set page after the applied template.

No, which is very confusing, but the theme uses it for the text color.