Add theme colors update reminder

This commit is contained in:
Hazem Krimi
2021-09-04 23:43:22 +01:00
parent 0fcaeb2cda
commit b953d57203
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ class Doc extends Document {
<script
dangerouslySetInnerHTML={{
__html: `
function getInitialColorMode() {
function getInitialTheme() {
const persistedColorPreference = window.localStorage.getItem('theme');
const hasPersistedPreference = typeof persistedColorPreference === 'string';
@@ -65,10 +65,10 @@ class Doc extends Document {
}
(() => {
const colorMode = getInitialColorMode();
const theme = getInitialTheme();
const root = document.documentElement;
root.style.setProperty('--theme', colorMode);
root.style.setProperty('--theme', theme);
})();
`
}}