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.
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:
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.
I confirm that does change the background color. But only some of the text is turned white. I’m sure that’s because each theme customizes text colors.
So, the remaining task for me is to customize foreground colors. For this purpose, the official manual of the university theme should be sufficient.
In the mean time, I found that the “sorbonne” theme has a switch to a “dark” mode. So, it may be easier for me to take this theme and customize it. (By default, it shows a fictitious logo of Sample University.)
I guess that at least the vocabulary (neutral-lightest, secondary, etc.) follows a convention across the themes? I guess what’s currently lacking is a convention for setting the background.
Yes, background and text color. If you can somehow link background to neutral-lightest by default (some callback function, I guess), then it would be easy to override it and add new standard color names.
Thanks, but can you elaborate on the “text color” bit of your answer?
I thought that secondary, primary, etc. specify “text colors”, and you said that these names are standardized (by convention). That means that the way to specify text colors is standardized . . . That’s what I thought.
But, you say that convention to set “text color” is lacking . . .
If you look inside university.typ, there is no general set text(color) anywhere, only for specific elements. It’s not set, therefore it’s not standardized. Hence why setting global text color just works. But metropolis does utilize some colors for background/text color.
Thanks! I begin to see . . . The standardized names primary, secondary, etc. are for specific elements, like titles and headers. The color of the general “body” text is not part of the theme and therefore you are supposed to use set text(color) for the “body” color.
Okay, I think ideally a “theme” should include all of the “elements”, “body”, and background, but for a theme that doesn’t do all these three, one is supposed to customize