import { hexFromArgb, Theme } from "@material/material-color-utilities"; import React from "react"; import { createContext, useContext } from "react"; import { useScheme } from "./useScheme"; const ThemeContext = createContext(undefined); export function ThemeProvider({ children, theme, scheme }: { children: React.ReactNode, theme: Theme, scheme: 'dark' | 'light' }) { return ( {children} ); } export function useTheme() { const context = useContext(ThemeContext); if (context === undefined) { throw new Error("useTheme must be used within a ThemeProvider"); } return context; } export function usePalette() { const theme = useTheme(); const scheme = useScheme(); return theme.schemes[scheme]; }