Commit d725d1f 1 parent e09ec3e commit d725d1f Copy full SHA for d725d1f
File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export function getProfile(): TargetProfile {
76
76
}
77
77
78
78
// get the preferred theme from system setting
79
- export function getPreferredTheme ( ) : "light" | "dark" {
79
+ function getPreferredTheme ( ) : "light" | "dark" {
80
80
if ( window . matchMedia && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ) {
81
81
return "dark" ;
82
82
}
@@ -257,10 +257,11 @@ export function Editor(props: {
257
257
258
258
useEffect ( ( ) => {
259
259
if ( ! editorDiv . current ) return ;
260
+ const initialTheme = getPreferredTheme ( ) ;
260
261
const newEditor = monaco . editor . create ( editorDiv . current , {
261
262
minimap : { enabled : false } ,
262
263
lineNumbersMinChars : 3 ,
263
- theme : theme === "dark" ? "vs-dark" : "vs" ,
264
+ theme : initialTheme === "dark" ? "vs-dark" : "vs" ,
264
265
} ) ;
265
266
266
267
editor . current = newEditor ;
You can’t perform that action at this time.
0 commit comments