Skip to content

Commit

Permalink
fix: monaco github theme not working
Browse files Browse the repository at this point in the history
  • Loading branch information
okikio authored Oct 7, 2021
1 parent 21d66d7 commit b31fa8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ts/modules/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
5 changes: 3 additions & 2 deletions src/ts/scripts/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit b31fa8d

Please sign in to comment.