const isDarkThemeOnLs = localStorage.getItem('dark');
this.isDarkTheme = isDarkThemeOnLs || window.matchMedia("(prefers-color-scheme: dark)");
const rootEl = document.getRootNode().documentElement;
rootEl.setAttribute("dark", this.isDarkTheme);
html {
color: blue;
}
html[dark] {
color: red;
}