WaspW
Wasp16mo ago
fustuk.

Dark theme by default?

Hey, I was wondering how to make 'dark' as default theme
export default function useColorMode() {
  const [colorMode, setColorMode] = useLocalStorage('color-theme', 'light');

  useEffect(() => {
    const className = 'dark';
    const bodyClass = window.document.body.classList;

    colorMode === 'dark'
      ? bodyClass.add(className)
      : bodyClass.remove(className);
  }, [colorMode]);

  return [colorMode, setColorMode];

I thought that this is is where its getting set initially but after changing useLocalStorage('color-theme', 'dark'); it is still the same
Was this page helpful?