@copilotkit/react-ui
Version:
<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>
11 lines (10 loc) • 403 B
text/typescript
export const useDarkMode = () => {
if (typeof window === "undefined") return false;
return (
document.documentElement.classList.contains("dark") ||
document.body.classList.contains("dark") ||
document.documentElement.getAttribute("data-theme") === "dark" ||
document.body.getAttribute("data-theme") === "dark" ||
window.matchMedia("(prefers-color-scheme: dark)").matches
);
};