mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Add theme colors update reminder
This commit is contained in:
@@ -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
@@ -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);
|
||||
})();
|
||||
`
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user