Skip to content

typst: customize light and dark logo at document level #13133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 31, 2025

Conversation

gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Jul 25, 2025

So you can do

logo:
  light: sun.png
  dark: moon.png

in typst format, to go with brand-mode and for compatibility with the other formats, which all allow this.

One quirk of the Quarto typst format is that you are allowed not to specify the path, so we extend that even to this:

logo:
  light: 
    location: left-top
    padding: 24px
    width: 250px
  dark:
    location: right-bottom
    padding: 40px
    width: 200px

I guess this is kind of silly, but there is a very well-typed function to make the conversion (by adding paths where needed), in case we unexpectedly decide the other formats need this. It would also be possible to extend resolveBrand to cover what fillLogoPaths is doing, but the Typescript gets very shaky with an object with all optional fields.

More likely, we will deprecate Typst's behavior.

Deletes 12 lines of an independent implementation of logo resolution that I never have to think about again.

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jul 25, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@gordonwoodhull gordonwoodhull force-pushed the feature/typst-customize-light-dark-alt-logo branch 2 times, most recently from 3037271 to 0f9a763 Compare July 26, 2025 19:32
the main point of this is to delete the final remaining
independent implementation of logo resolution and have
everything be consistent with the other formats

but yeah, also so that you can customize light and dark logos
we did not have any tests for this previously but it did work
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-customize-light-dark-alt-logo branch from 0f9a763 to e2bf972 Compare July 28, 2025 13:11
and properly extend this to {light,dark} with also optional path

this is kind of silly but this is how typst logo is historically
so if typst logo now takes light, dark then those also have optional path
i guess it's also proof that none of the other formats really need path

this does not extend to enabling dark brand in a typst document
only through the logo. that will fail to resolve a logo and you'll
need to enable dark brand in brand
@gordonwoodhull gordonwoodhull added this to the v1.8 milestone Jul 31, 2025
@gordonwoodhull gordonwoodhull merged commit edf4f8d into main Jul 31, 2025
51 checks passed
@gordonwoodhull gordonwoodhull deleted the feature/typst-customize-light-dark-alt-logo branch July 31, 2025 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants