Skip to content

Commit

Permalink
add: dark mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
windingwind committed Nov 29, 2023
1 parent 264f083 commit addf94c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,12 @@ async function openEditorWindow(content: string) {
return content;
}
await waitUtilAsync(() => !!editorWin.loadMonaco);
const isDark = addon.data.prefs.window?.matchMedia(
"(prefers-color-scheme: dark)",
).matches;
const { editor } = await editorWin.loadMonaco({
language: "javascript",
theme: "vs-light",
theme: "vs-" + (isDark ? "dark" : "light"),
});
addon.data.prefs.editorWindow = editorWin;
addon.data.prefs.editorInstance = editor;
Expand Down

0 comments on commit addf94c

Please sign in to comment.