diff --git a/apps/web/src/components/markdown-preview/index.vue b/apps/web/src/components/markdown-preview/index.vue index 08dbeb5ee..eba128524 100644 --- a/apps/web/src/components/markdown-preview/index.vue +++ b/apps/web/src/components/markdown-preview/index.vue @@ -1,6 +1,7 @@ @@ -39,6 +48,7 @@ const codeFontRenderKey = computed(() => settings.codeFontStack) :show-tooltips="false" :mermaid-props="{ showTooltips: false }" :code-block-monaco-options="codeBlockMonacoOptions" + :theme="codeBlockTheme" custom-id="file-preview-md" /> diff --git a/apps/web/src/components/monaco-editor/index.vue b/apps/web/src/components/monaco-editor/index.vue index 84ccd863b..4808993c4 100644 --- a/apps/web/src/components/monaco-editor/index.vue +++ b/apps/web/src/components/monaco-editor/index.vue @@ -114,8 +114,10 @@ function buildMarkdownHeadingSymbols(model: Monaco.editor.ITextModel, monaco: ty // The applied light/dark mode is driven by the `.dark` class on (set by the // color-mode store, which also honors "system"). Read it straight from the DOM so we // pick the right base theme even when the preference is "system". -function resolveThemeName(): 'vitesse-dark' | 'vitesse-light' { - return document.documentElement.classList.contains('dark') ? 'vitesse-dark' : 'vitesse-light' +function resolveThemeName(): string { + return document.documentElement.classList.contains('dark') + ? settings.shikiThemeDark + : settings.shikiThemeLight } const { @@ -128,7 +130,7 @@ const { getEditorView, } = useMonaco({ theme: resolveThemeName(), - themes: ['vitesse-dark', 'vitesse-light'], + themes: [settings.shikiThemeDark, settings.shikiThemeLight], readOnly: props.readonly, automaticLayout: true, autoScrollInitial: false, @@ -346,6 +348,11 @@ watch(editorFontFamily, (fontFamily) => { watch([() => props.language, () => props.filename], () => { setLanguage(resolveLanguage()) }) + +watch( + () => [settings.shikiThemeLight, settings.shikiThemeDark] as const, + () => { void syncEditorTheme() }, +)