@@ -59,14 +59,15 @@ function render_typst_brand_yaml()
5959 return {
6060 Pandoc = function (pandoc0 )
6161 local brand = param (' brand' )
62- local raw_block_shown = false
62+ local brandMode = ' light'
63+ brand = brand and brand [brandMode ]
6364 if brand and brand .processedData then
6465 -- color
6566 if brand .processedData .color and next (brand .processedData .color ) then
6667 local brandColor = brand .processedData .color
6768 local colors = {}
6869 for name , _ in pairs (brandColor ) do
69- colors [name ] = _quarto .modules .brand .get_color (name )
70+ colors [name ] = _quarto .modules .brand .get_color (brandMode , name )
7071 end
7172 local decl = ' #let brand-color = ' .. to_typst_dict_indent (colors )
7273 quarto .doc .include_text (' in-header' , decl )
@@ -93,7 +94,7 @@ function render_typst_brand_yaml()
9394 return key .. ' : ' .. value .. ' , '
9495 end
9596 -- typography
96- local base = _quarto .modules .brand .get_typography (' base' )
97+ local base = _quarto .modules .brand .get_typography (brandMode , ' base' )
9798 if base and next (base ) then
9899 quarto .doc .include_text (' in-header' , table.concat ({
99100 ' #set text(' ,
@@ -112,7 +113,7 @@ function render_typst_brand_yaml()
112113 end
113114 end
114115
115- local headings = _quarto .modules .brand .get_typography (' headings' )
116+ local headings = _quarto .modules .brand .get_typography (brandMode , ' headings' )
116117 if headings and next (headings ) then
117118 quarto .doc .include_text (' in-header' , table.concat ({
118119 ' #show heading: set text(' ,
@@ -133,7 +134,7 @@ function render_typst_brand_yaml()
133134 end
134135 end
135136
136- local monospaceInline = _quarto .modules .brand .get_typography (' monospace-inline' )
137+ local monospaceInline = _quarto .modules .brand .get_typography (brandMode , ' monospace-inline' )
137138 if monospaceInline and next (monospaceInline ) then
138139 quarto .doc .include_text (' in-header' , table.concat ({
139140 ' #show raw.where(block: false): set text(' ,
@@ -152,7 +153,7 @@ function render_typst_brand_yaml()
152153 }))
153154 end
154155
155- local monospaceBlock = _quarto .modules .brand .get_typography (' monospace-block' )
156+ local monospaceBlock = _quarto .modules .brand .get_typography (brandMode , ' monospace-block' )
156157 if monospaceBlock and next (monospaceBlock ) then
157158 quarto .doc .include_text (' in-header' , table.concat ({
158159 ' #show raw.where(block: true): set text(' ,
@@ -181,8 +182,8 @@ function render_typst_brand_yaml()
181182 end
182183 end
183184
184- local link = _quarto .modules .brand .get_typography (' link' )
185- local primaryColor = _quarto .modules .brand .get_color (' primary' )
185+ local link = _quarto .modules .brand .get_typography (brandMode , ' link' )
186+ local primaryColor = _quarto .modules .brand .get_color (brandMode , ' primary' )
186187 if link and next (link ) or primaryColor then
187188 link = link or {}
188189 quarto .doc .include_text (' in-header' , table.concat ({
@@ -209,21 +210,21 @@ function render_typst_brand_yaml()
209210 local foundLogo = null
210211 if logo then
211212 if type (logo ) == ' string' then
212- foundLogo = _quarto .modules .brand .get_logo (logo ) or {light = {path = logo }}
213+ foundLogo = _quarto .modules .brand .get_logo (brandMode , logo ) or {light = {path = logo }}
213214 elseif type (logo ) == ' table' then
214215 for k , v in pairs (logo ) do
215216 logoOptions [k ] = v
216217 end
217218 if logo .path then
218- foundLogo = _quarto .modules .brand .get_logo (logo .path ) or {light = {path = logo }}
219+ foundLogo = _quarto .modules .brand .get_logo (brandMode , logo .path ) or {light = {path = logo }}
219220 end
220221 end
221222 end
222223 if not foundLogo and brand .processedData .logo then
223224 local tries = {' large' , ' small' , ' medium' } -- low to high priority
224- foundLogo = _quarto .modules .brand .get_logo (' medium' )
225- or _quarto .modules .brand .get_logo (' small' )
226- or _quarto .modules .brand .get_logo (' large' )
225+ foundLogo = _quarto .modules .brand .get_logo (brandMode , ' medium' )
226+ or _quarto .modules .brand .get_logo (brandMode , ' small' )
227+ or _quarto .modules .brand .get_logo (brandMode , ' large' )
227228 end
228229 if foundLogo then
229230 if foundLogo .light then
@@ -299,21 +300,22 @@ function render_typst_brand_yaml()
299300 end
300301 end ,
301302 Meta = function (meta )
303+ local brandMode = ' light'
302304 -- it can contain the path but we want to store an object here
303305 if not meta .brand or pandoc .utils .type (meta .brand ) == ' Inlines' then
304306 meta .brand = {}
305307 end
306308 meta .brand .typography = meta .brand .typography or {}
307- local base = _quarto .modules .brand .get_typography (' base' )
309+ local base = _quarto .modules .brand .get_typography (brandMode , ' base' )
308310 if base and next (base ) then
309311 meta .brand .typography .base = {
310312 family = base .family ,
311313 size = base .size ,
312314 }
313315 end
314316
315- local headings = _quarto .modules .brand .get_typography (' headings' )
316- local foregroundColor = _quarto .modules .brand .get_color (' foreground' )
317+ local headings = _quarto .modules .brand .get_typography (brandMode , ' headings' )
318+ local foregroundColor = _quarto .modules .brand .get_color (brandMode , ' foreground' )
317319 if headings and next (headings ) or base and next (base ) or foregroundColor then
318320 base = base or {}
319321 headings = headings or {}
0 commit comments