"use client"; import colors, { hexToRgb } from "@/utils/colors"; import { useTheme } from "next-themes"; import React, { ReactNode, useEffect, useState } from "react"; import Circuit from "@/images/circuit.svg"; const Background = ({ children }: { children: ReactNode }) => { const { theme } = useTheme(); const [mounted, setMounted] = useState(false); // useEffect only runs on the client, so now we can safely show the UI useEffect(() => { setMounted(true); }, []); if (!mounted) { return (
); } const backgroundColor = hexToRgb(colors[theme!]["base-100"]); return (
{children}
); }; export default Background;