File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -772,6 +772,10 @@ kbd {
772772 display : none;
773773}
774774
775+ .dark-mode {
776+ color-scheme : dark;
777+ }
778+
775779.dark-mode .dark-icon {
776780 display : none;
777781}
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ <h1>Node.js __VERSION__ documentation</h1>
7373 const mq = window . matchMedia ( '(prefers-color-scheme: dark)' ) ;
7474 if ( 'onchange' in mq ) {
7575 function mqChangeListener ( e ) {
76- document . body . classList . toggle ( 'dark-mode' , e . matches ) ;
76+ document . documentElement . classList . toggle ( 'dark-mode' , e . matches ) ;
7777 }
7878 mq . addEventListener ( 'change' , mqChangeListener ) ;
7979 if ( themeToggleButton ) {
@@ -83,17 +83,17 @@ <h1>Node.js __VERSION__ documentation</h1>
8383 }
8484 }
8585 if ( mq . matches ) {
86- document . body . classList . add ( 'dark-mode' ) ;
86+ document . documentElement . classList . add ( 'dark-mode' ) ;
8787 }
8888 } else if ( userSettings === 'true' ) {
89- document . body . classList . add ( 'dark-mode' ) ;
89+ document . documentElement . classList . add ( 'dark-mode' ) ;
9090 }
9191 if ( themeToggleButton ) {
9292 themeToggleButton . hidden = false ;
9393 themeToggleButton . addEventListener ( 'click' , function ( ) {
9494 sessionStorage . setItem (
9595 kCustomPreference ,
96- document . body . classList . toggle ( 'dark-mode' )
96+ document . documentElement . classList . toggle ( 'dark-mode' )
9797 ) ;
9898 } ) ;
9999 }
You can’t perform that action at this time.
0 commit comments