We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AccentColorSelector
BaseLayout
export const AccentColorSelector = () => { const isBrowser = typeof window !== 'undefined' && window.localStorage; const [selectedTheme, setSelectedTheme] = useState(() => { const storedTheme = isBrowser && window.localStorage.getItem('themeSwitcher'); return storedTheme; }); useEffect(() => { return () => { window.removeEventListener('storage', handleStorageChange); }; }, []); const handleStorageChange = () => { const storedTheme = localStorage.getItem('themeSwitcher') || 'sky'; if (isBrowser && storedTheme !== selectedTheme) { setSelectedTheme(storedTheme); document.documentElement.setAttribute('data-theme', storedTheme); } }; isBrowser && window.addEventListener('storage', handleStorageChange); const handleThemeChange = (href: string) => { const theme = href.substring(1); setSelectedTheme(theme); localStorage.setItem('themeSwitcher', theme); document.documentElement.setAttribute('data-theme', theme); };
</x-turndown> const storedThemeColor = localStorage.getItem('themeSwitcher'); const theme = storedThemeColor || 'sky'; document.documentElement.setAttribute('data-theme', theme);
The text was updated successfully, but these errors were encountered:
ASTRO-144 Investigate `AccentColorSelector` logic in conjunction with it's `BaseLayout` script
Sorry, something went wrong.
AVGVSTVS96
No branches or pull requests
The text was updated successfully, but these errors were encountered: