Skip to content

Commit

Permalink
feat: add defaultTheme option
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX committed Oct 9, 2024
1 parent c00f6fc commit 7c6cfa3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ export interface MountPlainShikiOptions {
lang: BundledLanguage;

/**
* @description Theme of the code to be highlighted.
* @description Themes of the code to be highlighted.
*
* @default {light:"min-light",dark:"min-dark"}
*/
themes?: CodeToTokensWithThemesOptions<BundledLanguage, BundledTheme>["themes"];

/**
* @description Name of default theme.
*
* @default "light"
*/
defaultTheme?: string;

/**
* @description Root element selector corresponding to the theme.
*
Expand Down Expand Up @@ -52,6 +59,7 @@ export function createPlainShiki(shiki: HighlighterCore) {
light: "min-light",
dark: "min-dark"
},
defaultTheme = "light",
selector = (theme) => `.${theme}`,
watch = true,
delay = 0
Expand Down Expand Up @@ -94,7 +102,7 @@ export function createPlainShiki(shiki: HighlighterCore) {
}

for (const { range, color, theme, name } of walkTokens(loads)) {
const isDefault = theme === "light";
const isDefault = theme === defaultTheme;

let highlight = CSS.highlights.get(name);
if (!highlight) {
Expand Down

0 comments on commit 7c6cfa3

Please sign in to comment.