Skip to content

Commit

Permalink
fix(playground): change shiki theme on colorMode change
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed May 2, 2024
1 parent d9121d0 commit f15f84e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,18 @@ async function getShiki(
});
}
let highlighter: HighlighterGeneric<BundledLanguage, BundledTheme>;
watch([colorMode, mode, len, min, max, refreshKey], () =>
getShiki(highlighter),
);
onMounted(async () => {
async function getShikiHighlighter() {
highlighter = await getHighlighter({
themes: [colorMode.value === 'light' ? 'min-light' : 'github-dark'],
langs: ['typescript'],
});
await getShiki(highlighter);
});
}
let highlighter: HighlighterGeneric<BundledLanguage, BundledTheme>;
watch([mode, len, min, max, refreshKey], () => getShiki(highlighter));
watch(colorMode, getShikiHighlighter);
onMounted(getShikiHighlighter);
</script>

<style>
Expand Down

0 comments on commit f15f84e

Please sign in to comment.