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
+1
View File
@@ -2,6 +2,7 @@ import { FC } from 'react';
import { ThemeProvider, DefaultTheme } from 'styled-components';
const Theme: FC = ({ children }) => {
// TODO: put theme colors in css custom properties and put common colors here.
const theme: DefaultTheme = {
colors: {
dark: {
+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);
})();
`
}}