Touying: How to set background colour for presentation?

I am trying to add to the simple theme available for Touying so that it shows text on another background colour other than white. It appears to work for focus slides (that is, they can change colour), but I cannot for the life of me understand how to change the background colour to a default rgb(“#FDECB2”). It feels like something that should be easy to do, so I suspect that may Typst skills are not really what they should be for solving this.

Any help would be nice, I really like Typst and would like to convert all my presentations to Typst rather than having them in LaTeX as I do right now.

Hello @Tobias_Andersson_Gid, and welcome!

Don’t hesitate to read How to post in the Questions category, and add a small example that shows your current progress, or images of the desired output, so we can help you better.

Have you perhaps looked at Build Your Own Theme | Touying? Touying uses a specific utility function to configure colors, to be set in the touying-slides function. Hope that helps,

1 Like

Hey @Tobias_Andersson_Gid, welcome to the forum! Please post questions in the Questions category, which is made for this purpose (I’ve moved your post there!). According to the guidelines linked above by @quachpas, please also make sure your question post’s title is a question you’d ask to a friend about Typst (I’ve updated the title for you!). Thanks, and have fun using the forum! :typstguy:

Thanks for the nice words and help, I will comply with the rules from now on!

I have checked the documentation for Touying but not been able to fully understand the colour part (seems to be different for different themes).

Currently I am away but will try to include an example of what I am doing as soon as I can.

2 Likes

Hi @Tobias_Andersson_Gid. In Touying, the background color can be changed by modifying the config-colors dictionnary.

#show: presentation-theme.with(
  config-colors(background: rgb(“#FDECB2”))
 )

Cheers!

Thanks a lot, however, I cannot get that to work. Just copying and pasting will result in presentation-theme not being found. Could it be different for different themes?

I have tried to follow the guides for designing a new theme, but using touying-slides function will only give me the background colour for one slide, not all.

I will continue to work with your feedback and see what I can do, so thanks all of you!

I am out of my office. I will send the solution tomorrow by sharing an example on the Typst app.

Just a comment, what I meant by presentation-theme was the name of the touying template.

For instance

// For simple theme
#show: simple-theme.with(...)

// For metropolis theme
#show: metropolis-theme.with(...)

and so on.

Right, my bad! Adding the colour for the background still does not change the background, but I found out that by using Metropolis as the basis, I could change “neutral-lightest” which actually changed the background:

#show: metropolis-theme.with(
  aspect-ratio: "16-9",
  footer: self => self.info.institution,
  config-info(
    title: [Title],
    subtitle: [Subtitle],
    author: [Authors],
    date: datetime.today(),
    institution: [Institution],
    logo: box(height: 25pt, image("logo.svg")),
  ),
  config-colors(
    primary: rgb("#5D4FB1"),
    secondary: rgb("#5D4FB1"),
    neutral-lightest: rgb("#FDECB2"),
  ),
)

So, it seems to work and I have learned a lot from your help a of you – so thanks a lot!

1 Like