Skip to content
Snippets Groups Projects
Commit 90ba51ee authored by syuilo's avatar syuilo
Browse files

Fix dark mode sync

parent 9f49c663
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ import Dialog from './components/dialog.vue';
import Menu from './components/menu.vue';
import { router } from './router';
import { applyTheme, lightTheme, builtinThemes } from './theme';
import { isDeviceDarkmode } from './scripts/is-device-darkmode';
Vue.use(Vuex);
Vue.use(VueHotkey);
......@@ -144,11 +145,17 @@ os.init(async () => {
}
}, false)
//#region Sync dark mode
if (os.store.state.device.syncDeviceDarkMode) {
os.store.commit('device/set', { key: 'darkMode', value: isDeviceDarkmode() });
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(mql => {
if (os.store.state.device.syncDeviceDarkMode) {
os.store.commit('device/set', { key: 'darkMode', value: mql.matches });
}
});
//#endregion
if ('Notification' in window && os.store.getters.isSignedIn) {
// 許可を得ていなかったらリクエスト
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment