File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -283,6 +283,10 @@ export default class ThemeBuilder {
283283 . hex . toString ( ) ;
284284 }
285285
286+ matches ( id ) {
287+ return this . id . toLowerCase ( ) === id . toLowerCase ( ) ;
288+ }
289+
286290 /**
287291 * Creates a theme from a CSS string
288292 * @param {string } name
Original file line number Diff line number Diff line change @@ -14,13 +14,6 @@ let firstTime = true;
1414
1515function init ( ) {
1616 themes . forEach ( ( theme ) => add ( theme ) ) ;
17- const { appTheme } = settings . value ;
18- if ( appTheme !== "system" ) {
19- apply ( appTheme ) ;
20- } else {
21- updateSystemTheme ( isDeviceDarkTheme ( ) ) ;
22- themeApplied = true ;
23- }
2417}
2518
2619/**
@@ -68,6 +61,17 @@ function add(theme) {
6861 if ( appThemes . has ( theme . id ) ) return ;
6962
7063 appThemes . set ( theme . id , theme ) ;
64+
65+ const { appTheme } = settings . value ;
66+
67+ if ( theme . matches ( appTheme ) ) {
68+ if ( appTheme !== "system" ) {
69+ apply ( appTheme ) ;
70+ } else {
71+ updateSystemTheme ( isDeviceDarkTheme ( ) ) ;
72+ themeApplied = true ;
73+ }
74+ }
7175}
7276
7377/**
You can’t perform that action at this time.
0 commit comments