Skip to content

feat: add fill and stroke keys to the Typst theme - #97

Merged
mcanouil merged 6 commits into
mainfrom
feat/typst-theme-fill-stroke
Nov 23, 2026
Merged

mcanouil merged 6 commits into
mainfrom
feat/typst-theme-fill-stroke

Conversation

@mcanouil

@mcanouil mcanouil commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

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 (default auto) sets the background of each highlighted code block, in a window and out of it.
    auto keeps the highlight style's background, and none removes 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 (default auto) replaces the window border with any Typst stroke, a per-side dictionary included.
    auto keeps the border built from border, stroke-thickness, and stroke-dash, and the line below the title bar keeps that build either way.

With fill: rgb("#00ff00") and stroke: (top: 3pt + rgb("#0000ff"), rest: none) in the theme:

A code window with only a blue top rule and a green code background, above a plain code block that also has the green background

tests/run.sh checks both keys in the compiled SVG.

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.
@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Nov 22, 2026
@mcanouil mcanouil self-assigned this Nov 22, 2026
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.
@mcanouil
mcanouil marked this pull request as ready for review November 22, 2026 21:55
@mcanouil
mcanouil merged commit 4e27a07 into main Nov 23, 2026
4 checks passed
@mcanouil
mcanouil deleted the feat/typst-theme-fill-stroke branch November 23, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant