import { useEffect } from 'react';
import { useColorMode } from '@/components/ui/ThemeProvider';
import { useSettings } from 'state/useSettings';

export const useColorModeSync = () => {
  const { settings } = useSettings();
  const { setColorMode } = useColorMode();

  useEffect(() => {
    if (!settings) return;
    setColorMode(settings.appearance.colorMode);
  }, [settings?.appearance?.colorMode]);
};
