diff --git a/client/src/context/ThemeContext.jsx b/client/src/context/ThemeContext.jsx index 9836cef1..b8a0a51a 100644 --- a/client/src/context/ThemeContext.jsx +++ b/client/src/context/ThemeContext.jsx @@ -20,6 +20,15 @@ const ThemeContextProvider = ({ children }) => { useEffect(() => { const currentHour = new Date().getHours(); setDarkTheme(currentHour >= 20 || currentHour <= 8 ? true : false); + localStorage.setItem( + 'darkTheme', + currentHour >= 20 || currentHour <= 8 ? 'true' : 'false', + ); + if (localStorage.getItem('darkTheme') === 'true') { + setDarkTheme(true); + } else if (localStorage.getItem('darkTheme') === 'false') { + setDarkTheme(false); + } }, [setDarkTheme]); return (