Skip to content

Commit ffe274c

Browse files
brand.typography.headings must populate foreground color
because we don't have a way to not-set optional properties in Typst
1 parent 1947398 commit ffe274c

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

src/resources/filters/quarto-post/typst-brand-yaml.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,15 @@ function render_typst_brand_yaml()
301301
end
302302

303303
local headings = _quarto.modules.brand.get_typography('headings')
304-
if headings and next(headings) then
304+
if headings and next(headings) or _quarto.modules.brand.get_color('foreground') then
305305
base = base or {}
306+
headings = headings or {}
306307
meta.brand.typography.headings = {
307308
family = headings.family or base.family,
308309
weight = headings.weight or base.weight,
309310
style = headings.style or base.style,
310311
decoration = headings.decoration or base.decoration,
311-
color = headings.color or base.color,
312+
color = headings.color or _quarto.modules.brand.get_color('foreground'),
312313
['background-color'] = headings['background-color'] or base['background-color'],
313314
['line-height'] = line_height_to_leading(headings['line-height'] or base['line-height']),
314315
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Foreground and background colors
3+
format:
4+
typst:
5+
keep-typ: true
6+
brand:
7+
color:
8+
foreground: "#ccd2b2"
9+
background: "#0d0519"
10+
typography:
11+
monospace-block:
12+
background-color: "#ccd2b250"
13+
14+
_quarto:
15+
tests:
16+
typst:
17+
ensureTypstFileRegexMatches:
18+
-
19+
- '#set page\(fill: brand-color\.background\)'
20+
- '#set text\(fill: brand-color\.foreground\)'
21+
- 'heading-color: unescape-eval\("rgb\(\\"\\#ccd2b2\\"\)"\)'
22+
- []
23+
---
24+
25+
# Just double checking...
26+
27+
That simple background and foreground colors work everywhere.
28+
29+
Here is some `inline code`.
30+
31+
```
32+
You are going to need to customize
33+
your code blocks for dark mode!
34+
```
35+
36+
{{< lipsum 2 >}}

0 commit comments

Comments
 (0)