Repository navigation
feat: add fill and stroke keys to the Typst theme - #97
Merged
Merged
Conversation
A template could not set the code background, which came from the Skylighting fill, nor draw the window border on some sides only. The fill key sets the code background, and the stroke key replaces the window border with any Typst stroke.
The test edits the rendered typst-theme source rather than rendering a second fixture, and a compile_svg helper replaces the copied compile block. The Skylighting override and the window resolve the new keys once.
With none as the default, a template could not ask for a code block with no background. auto now keeps the highlight style's background, and none removes it.
The changelog entry now names the pull request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Typst template can now set the code background and draw the window border on some sides only, through two new keys in
state("code-window-theme").fill(defaultauto) sets the background of each highlighted code block, in a window and out of it.autokeeps the highlight style's background, andnoneremoves it.The Skylighting override reads it ahead of its own fill, so a template no longer needs to patch the output to tint the code.
With native Typst highlighting it applies inside a window.
stroke(defaultauto) replaces the window border with any Typst stroke, a per-side dictionary included.autokeeps the border built fromborder,stroke-thickness, andstroke-dash, and the line below the title bar keeps that build either way.With
fill: rgb("#00ff00")andstroke: (top: 3pt + rgb("#0000ff"), rest: none)in the theme:tests/run.shchecks both keys in the compiled SVG.