File tree 2 files changed +14
-15
lines changed 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change
1
+ ( function ( ) {
2
+ const localStorageTheme = localStorage . getItem ( "theme" ) ;
3
+ const systemSettingDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ;
4
+
5
+ let theme = "light" ;
6
+ if ( localStorageTheme ) {
7
+ theme = localStorageTheme ;
8
+ } else if ( systemSettingDark ) {
9
+ theme = "dark" ;
10
+ }
11
+
12
+ document . documentElement . setAttribute ( "data-theme" , theme ) ;
13
+ } ) ( ) ;
Original file line number Diff line number Diff line change 9
9
content ="NoteKeeper is a Firefox extension that transforms the New Tab into a minimalist, auto-saving text editor. ">
10
10
< link rel ="icon " type ="image/png " sizes ="48x48 " href ="icons/icon48.png " />
11
11
<!-- Prevent flash of incorrect theme -->
12
- < script >
13
- ( function ( ) {
14
- const localStorageTheme = localStorage . getItem ( "theme" ) ;
15
- const systemSettingDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ;
16
-
17
- let theme = "light" ;
18
- if ( localStorageTheme ) {
19
- theme = localStorageTheme ;
20
- } else if ( systemSettingDark ) {
21
- theme = "dark" ;
22
- }
23
-
24
- document . documentElement . setAttribute ( "data-theme" , theme ) ;
25
- } ) ( ) ;
26
- </ script >
12
+ < script type ="text/javascript " src ="js/theme-init.js "> </ script >
27
13
< link rel ="stylesheet " href ="styles.css " />
28
14
</ head >
29
15
You can’t perform that action at this time.
0 commit comments