mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-14 12:16:24 +09:00
16 lines
317 B
TypeScript
16 lines
317 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
const useTheme = (): string => {
|
|
const [themeValue, setThemeValue] = useState("");
|
|
|
|
useEffect(() => {
|
|
setThemeValue(
|
|
document.documentElement.classList.contains("dark") ? "dark" : "light",
|
|
);
|
|
}, []);
|
|
|
|
return themeValue;
|
|
};
|
|
|
|
export default useTheme;
|