Skip to content

Commit

Permalink
fix(dual-theme): respect users' explicit options
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 14, 2023
1 parent 0caa813 commit d39dee5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/shikiji/src/core/renderer-html-dual-themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ export function renderToHtmlDualThemes(
}
}

const fg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}:`) + t[2].fg).join(';')
const bg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}-bg:`) + t[2].bg).join(';')
const fg = options.fg || themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}:`) + t[2].fg).join(';')
const bg = options.bg || themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t[0]}-bg:`) + t[2].bg).join(';')
return renderToHtml(merged, {
...options,
fg,
bg,
themeName: `shiki-dual-themes ${themes.map(t => t[2].name).join(' ')}`,
rootStyle: defaultColor ? undefined : [fg, bg].join(';'),
...options,
})
}

0 comments on commit d39dee5

Please sign in to comment.