Skip to content

Commit 3b8d57b

Browse files
typst brand yaml: link color defaults to brand primary color
1 parent f0b3715 commit 3b8d57b

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,13 @@ function render_typst_brand_yaml()
182182
end
183183

184184
local link = _quarto.modules.brand.get_typography('link')
185-
if link and next(link) then
185+
local primaryColor = _quarto.modules.brand.get_color('primary')
186+
if link and next(link) or primaryColor then
187+
link = link or {}
186188
quarto.doc.include_text('in-header', table.concat({
187189
'#show link: set text(',
188190
conditional_entry('weight', link.weight),
189-
conditional_entry('fill', link.color, false),
191+
conditional_entry('fill', link.color or primaryColor, false),
190192
')'
191193
}))
192194
end
@@ -304,15 +306,16 @@ function render_typst_brand_yaml()
304306
end
305307

306308
local headings = _quarto.modules.brand.get_typography('headings')
307-
if headings and next(headings) or _quarto.modules.brand.get_color('foreground') then
309+
local foregroundColor = _quarto.modules.brand.get_color('foreground')
310+
if headings and next(headings) or foregroundColor then
308311
base = base or {}
309312
headings = headings or {}
310313
meta.brand.typography.headings = {
311314
family = headings.family or base.family,
312315
weight = headings.weight or base.weight,
313316
style = headings.style or base.style,
314317
decoration = headings.decoration or base.decoration,
315-
color = headings.color or _quarto.modules.brand.get_color('foreground'),
318+
color = headings.color or foregroundColor,
316319
['background-color'] = headings['background-color'] or base['background-color'],
317320
['line-height'] = line_height_to_leading(headings['line-height'] or base['line-height']),
318321
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Foreground and background colors
3+
format:
4+
typst:
5+
keep-typ: true
6+
brand:
7+
color:
8+
palette:
9+
fire: "#dd571c"
10+
primary: fire
11+
12+
_quarto:
13+
tests:
14+
typst:
15+
ensurePdfRegexMatches:
16+
-
17+
- 'a link in rgb\("#dd571c"\)'
18+
- []
19+
---
20+
21+
Here is [a link in `#context text.fill`{=typst}](http://example.com).

0 commit comments

Comments
 (0)