Skip to content

Commit a4fb372

Browse files
authored
Set color-scheme property of :root element (luizdepra#632)
By setting the color-scheme property of the :root element we get matching (dark or light) scrollbars and form controls. see: https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
1 parent d14dd83 commit a4fb372

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

assets/js/coder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function setTheme(theme) {
3333
let inverse = theme === 'dark' ? 'light' : 'dark';
3434
body.classList.remove('colorscheme-' + inverse);
3535
body.classList.add('colorscheme-' + theme);
36+
document.documentElement.style['color-scheme'] = theme;
3637
}
3738

3839
function rememberTheme(theme) {

0 commit comments

Comments
 (0)