This commit is contained in:
Vanessa 2022-09-27 21:55:18 +08:00
parent 06b88df2dd
commit 9f96ddc842

View file

@ -312,16 +312,18 @@ const initWindow = () => {
}); });
ipcRenderer.on(Constants.SIYUAN_UPDATE_THEME, (event, data) => { ipcRenderer.on(Constants.SIYUAN_UPDATE_THEME, (event, data) => {
if (data.init) { if (data.init) {
if ((window.siyuan.config.appearance.mode === 0 && data.theme === "light") || if (window.siyuan.config.appearance.modeOS && (
(window.siyuan.config.appearance.mode === 1 && data.theme === "dark")) { (window.siyuan.config.appearance.mode === 1 && data.theme === "light") ||
loadAssets(window.siyuan.config.appearance); (window.siyuan.config.appearance.mode === 0 && data.theme === "dark")
} else { )) {
fetchPost("/api/system/setAppearanceMode", { fetchPost("/api/system/setAppearanceMode", {
mode: data.theme === "light" ? 0 : 1 mode: data.theme === "light" ? 0 : 1
}, response => { }, response => {
window.siyuan.config.appearance = response.data.appearance; window.siyuan.config.appearance = response.data.appearance;
loadAssets(response.data.appearance); loadAssets(response.data.appearance);
}); });
} else {
loadAssets(window.siyuan.config.appearance);
} }
return; return;
} }