Set color-scheme property of :root element (#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
This commit is contained in:
Alphonse Mariya
2021-12-26 19:22:40 +01:00
committed by GitHub
parent d14dd837ec
commit a4fb372e6b

View File

@@ -33,6 +33,7 @@ function setTheme(theme) {
let inverse = theme === 'dark' ? 'light' : 'dark';
body.classList.remove('colorscheme-' + inverse);
body.classList.add('colorscheme-' + theme);
document.documentElement.style['color-scheme'] = theme;
}
function rememberTheme(theme) {