ui-theme/dist/components/useTheme.js
Natalie aaf23fa33f feat(@cocotte/ui-theme): extract UI theme package to @ct/@packages
Re-scoped from @lilith/ui-theme to @cocotte/ui-theme. In-set cross-package deps
re-pointed to @cocotte; out-of-set @lilith deps preserved (same Verdaccio).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 13:04:11 -04:00

23 lines
No EOL
619 B
JavaScript

import { useContext } from 'react';
import { ThemeContext } from './ThemeProvider';
/**
* Hook to access theme context
*
* @throws Error if used outside of ThemeProvider
*
* @example
* ```tsx
* function MyComponent() {
* const { theme, themeName, setTheme } = useTheme();
* return <button onClick={() => setTheme('luxe')}>Switch Theme</button>;
* }
* ```
*/
export function useTheme() {
const context = useContext(ThemeContext);
if (context === undefined) {
throw new Error('useTheme must be used within a ThemeProvider');
}
return context;
}
//# sourceMappingURL=useTheme.js.map