feat: auto dark mode (#321)

This commit is contained in:
XYenon
2025-10-15 12:43:24 +08:00
committed by GitHub
parent a095a2c01c
commit 6827985289
5 changed files with 46 additions and 7 deletions

View File

@@ -33,6 +33,15 @@ export function SettingProvider({ children }) {
reload,
} = useStorage(STOKEY_SETTING, DEFAULT_SETTING, KV_SETTING_KEY);
useEffect(() => {
if (typeof setting?.darkMode === "boolean") {
update((currentSetting) => ({
...currentSetting,
darkMode: currentSetting.darkMode ? "dark" : "light",
}));
}
}, [setting?.darkMode, update]);
useEffect(() => {
(async () => {
try {