useSpectreTheme
Hook to read and control the current spectre-ui theme.
Usage
import { useSpectreTheme } from "@spectre-ui/core";
function ThemeToggle() {
const { theme, setTheme, toggleTheme } = useSpectreTheme();
return (
<button onClick={toggleTheme}>
Current theme: {theme}
</button>
);
}Return Value
{
theme: "dark" | "light", // Current theme
setTheme: (theme) => void, // Set specific theme
toggleTheme: () => void, // Toggle between dark/light
}