From b31fa8d5645404e78ee9699ce7151a8a38b857b5 Mon Sep 17 00:00:00 2001 From: Okiki Date: Thu, 7 Oct 2021 15:05:22 +0000 Subject: [PATCH] fix: monaco github theme not working --- src/ts/modules/monaco.ts | 5 ++++- src/ts/scripts/theme.ts | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ts/modules/monaco.ts b/src/ts/modules/monaco.ts index d31eccf6..c0aea81b 100644 --- a/src/ts/modules/monaco.ts +++ b/src/ts/modules/monaco.ts @@ -344,7 +344,10 @@ export const build = () => { roundedSelection: true, scrollBeyondLastLine: true, smoothScrolling: true, - theme: themeGet(), + theme: (() => { + let theme = themeGet(); + return theme == "system" ? mediaTheme() : theme; + })(), automaticLayout: true, language: "typescript", diff --git a/src/ts/scripts/theme.ts b/src/ts/scripts/theme.ts index c356b085..d04574ab 100644 --- a/src/ts/scripts/theme.ts +++ b/src/ts/scripts/theme.ts @@ -52,8 +52,9 @@ export let themeSet = (theme: string) => { export let runTheme = () => { try { let theme = getTheme(); - if (theme === null) theme = mediaTheme(); - theme && themeSet(theme); + if (theme === null) { + themeSet("system"); + } else themeSet(theme); window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => { themeSet("system");