mirror of
https://github.com/13hannes11/hugo-coder-timeline.git
synced 2024-09-04 00:50:58 +02:00
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:
@@ -33,6 +33,7 @@ function setTheme(theme) {
|
|||||||
let inverse = theme === 'dark' ? 'light' : 'dark';
|
let inverse = theme === 'dark' ? 'light' : 'dark';
|
||||||
body.classList.remove('colorscheme-' + inverse);
|
body.classList.remove('colorscheme-' + inverse);
|
||||||
body.classList.add('colorscheme-' + theme);
|
body.classList.add('colorscheme-' + theme);
|
||||||
|
document.documentElement.style['color-scheme'] = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rememberTheme(theme) {
|
function rememberTheme(theme) {
|
||||||
|
|||||||
Reference in New Issue
Block a user