Commit 6a7b016 1 parent 1eac0a1 commit 6a7b016 Copy full SHA for 6a7b016
File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -772,6 +772,10 @@ kbd {
772
772
display : none;
773
773
}
774
774
775
+ .dark-mode {
776
+ color-scheme : dark;
777
+ }
778
+
775
779
.dark-mode .dark-icon {
776
780
display : none;
777
781
}
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ <h1>Node.js __VERSION__ documentation</h1>
73
73
const mq = window . matchMedia ( '(prefers-color-scheme: dark)' ) ;
74
74
if ( 'onchange' in mq ) {
75
75
function mqChangeListener ( e ) {
76
- document . body . classList . toggle ( 'dark-mode' , e . matches ) ;
76
+ document . documentElement . classList . toggle ( 'dark-mode' , e . matches ) ;
77
77
}
78
78
mq . addEventListener ( 'change' , mqChangeListener ) ;
79
79
if ( themeToggleButton ) {
@@ -83,17 +83,17 @@ <h1>Node.js __VERSION__ documentation</h1>
83
83
}
84
84
}
85
85
if ( mq . matches ) {
86
- document . body . classList . add ( 'dark-mode' ) ;
86
+ document . documentElement . classList . add ( 'dark-mode' ) ;
87
87
}
88
88
} else if ( userSettings === 'true' ) {
89
- document . body . classList . add ( 'dark-mode' ) ;
89
+ document . documentElement . classList . add ( 'dark-mode' ) ;
90
90
}
91
91
if ( themeToggleButton ) {
92
92
themeToggleButton . hidden = false ;
93
93
themeToggleButton . addEventListener ( 'click' , function ( ) {
94
94
sessionStorage . setItem (
95
95
kCustomPreference ,
96
- document . body . classList . toggle ( 'dark-mode' )
96
+ document . documentElement . classList . toggle ( 'dark-mode' )
97
97
) ;
98
98
} ) ;
99
99
}
You can’t perform that action at this time.
0 commit comments