Skip to content

Commit d39dee5

Browse files
committed
fix(dual-theme): respect users' explicit options
1 parent 0caa813 commit d39dee5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/shikiji/src/core/renderer-html-dual-themes.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ export function renderToHtmlDualThemes(
7878
}
7979
}
8080

81-
const fg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}:`) + t[2].fg).join(';')
82-
const bg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}-bg:`) + t[2].bg).join(';')
81+
const fg = options.fg || themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}:`) + t[2].fg).join(';')
82+
const bg = options.bg || themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}-bg:`) + t[2].bg).join(';')
8383
return renderToHtml(merged, {
84-
...options,
8584
fg,
8685
bg,
8786
themeName: `shiki-dual-themes ${themes.map(t => t[2].name).join(' ')}`,
8887
rootStyle: defaultColor ? undefined : [fg, bg].join(';'),
88+
...options,
8989
})
9090
}

0 commit comments

Comments
 (0)