File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ $family-sans-serif: "Jost", sans-serif;
8
8
$footer-padding : 1.0rem 2.5rem ;
9
9
10
10
@mixin base_dark
11
- filter : invert (1 ) hue- rotate(180deg );
12
-
11
+ body ,
13
12
img ,
14
13
picture ,
15
14
video ,
26
25
min-height : 100vh ;
27
26
28
27
29
- body [theme="dark"]
28
+ html [theme="dark"]
30
29
@include base_dark ()
31
30
32
31
33
- body [theme="auto"]
32
+ html [theme="auto"]
34
33
@media (prefers-color-scheme : dark )
35
34
@include base_dark ()
36
35
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ function search() {
171
171
}
172
172
173
173
function setTheme ( color ) {
174
- document . body . setAttribute ( "theme" , color ) ;
174
+ document . documentElement . setAttribute ( "theme" , color ) ;
175
175
document . getElementById ( "dark-mode" ) . setAttribute ( "title" , "Switch to " + color + " theme" ) ;
176
176
}
177
177
@@ -219,7 +219,7 @@ function documentReadyCallback() {
219
219
} ) ;
220
220
221
221
document . getElementById ( "dark-mode" ) . addEventListener ( "click" , ( ) => {
222
- const theme = document . body . getAttribute ( "theme" ) ;
222
+ const theme = document . documentElement . getAttribute ( "theme" ) ;
223
223
const isDarkMode = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ;
224
224
if (
225
225
theme === "light" || theme === null || ( theme === "auto" && ! isDarkMode )
You can’t perform that action at this time.
0 commit comments