{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "theme-context",
  "title": "Theme Context",
  "description": "The context behind `useTheme`: the current color scheme and palette.",
  "registryDependencies": [
    "https://guillermo-rebolledo.github.io/materialcn/r/palettes.json"
  ],
  "files": [
    {
      "path": "src/components/theme-context.ts",
      "content": "/**\n * The theme context and its hook, kept out of the provider module.\n *\n * `useTheme` is a hook rather than a component, so exporting it alongside\n * `ThemeProvider` would stop that file from being a React Fast Refresh\n * boundary — every edit to the provider would full-reload the page. Defined\n * here, the hook's identity survives those edits.\n */\nimport { createContext, use } from \"react\"\n\nimport type { Palette } from \"@/lib/palettes\"\n\nexport type Theme = \"light\" | \"dark\" | \"system\"\n\nexport type ThemeContextValue = {\n  /** What was asked for — may be \"system\". */\n  theme: Theme\n  /** What is actually on screen right now. Never \"system\". */\n  resolvedTheme: \"light\" | \"dark\"\n  setTheme: (theme: Theme) => void\n  /**\n   * Which colour palette is applied. Orthogonal to `theme`: a palette carries\n   * both a light and a dark scheme, and switching one does not disturb the\n   * other.\n   */\n  palette: Palette\n  setPalette: (palette: Palette) => void\n}\n\nexport const ThemeContext = createContext<ThemeContextValue | null>(null)\n\nexport function useTheme() {\n  const context = use(ThemeContext)\n  if (!context) {\n    throw new Error(\"useTheme must be used within a <ThemeProvider>\")\n  }\n  return context\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "theme"
  ],
  "type": "registry:component"
}