diff --git a/moonbit-tour/build/shiki.ts b/moonbit-tour/build/shiki.ts index 5fdfa814..df931dbc 100644 --- a/moonbit-tour/build/shiki.ts +++ b/moonbit-tour/build/shiki.ts @@ -6,14 +6,17 @@ const moonbitLang = JSON.parse( ); const highlighter = await shiki.createHighlighter({ - themes: ["light-plus"], + themes: ["light-plus", "dark-plus"], langs: [moonbitLang], }); function renderMoonBitCode(code: string): string { return highlighter.codeToHtml(code, { lang: "moonbit", - theme: "light-plus", + themes: { + light: "light-plus", + dark: "dark-plus", + }, }); } diff --git a/moonbit-tour/index.html b/moonbit-tour/index.html index df8ca7e0..2dd85265 100644 --- a/moonbit-tour/index.html +++ b/moonbit-tour/index.html @@ -86,5 +86,26 @@ + diff --git a/moonbit-tour/src/style.css b/moonbit-tour/src/style.css index bb544399..9aa31872 100644 --- a/moonbit-tour/src/style.css +++ b/moonbit-tour/src/style.css @@ -39,3 +39,13 @@ margin-left: 1rem; color: #dc1894 !important; } + +html.dark .shiki, +html.dark .shiki span { + color: var(--shiki-dark) !important; + background-color: var(--shiki-dark-bg) !important; + /* Optional, if you also want font styles */ + font-style: var(--shiki-dark-font-style) !important; + font-weight: var(--shiki-dark-font-weight) !important; + text-decoration: var(--shiki-dark-text-decoration) !important; +}