import { DEFAULT_COLORS } from '@/src/utils/color';

export function setGlobalColors(colors: Record<string, string>) {
  const root = document.documentElement;
  const theme = localStorage.getItem('theme');

  if (theme === 'dark') {
    root.style.setProperty('--color-background', colors.text || DEFAULT_COLORS.text);
    root.style.setProperty('--color-text', colors.background || DEFAULT_COLORS.background);
  } else {
    root.style.setProperty('--color-background', colors.background || DEFAULT_COLORS.background);
    root.style.setProperty('--color-text', colors.text || DEFAULT_COLORS.text);
  }

  root.style.setProperty('--color-accent', colors.accent || DEFAULT_COLORS.accent);
}
