Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14157

Vanessad215c2e0e2c5
diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts
index a0f665bec9..f3dca2fca5 100644
--- a/app/src/util/assets.ts
+++ b/app/src/util/assets.ts
@@ -365,8 +365,16 @@ export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
export const setMode = (modeElementValue: number) => {
/// #if !MOBILE
+ let mode = modeElementValue;
+ if (modeElementValue === 2) {
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
+ mode = 1;
+ } else {
+ mode = 0;
+ }
+ }
fetchPost("/api/setting/setAppearance", Object.assign({}, window.siyuan.config.appearance, {
- mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
+ mode,
modeOS: modeElementValue === 2,
}), async response => {
if (window.siyuan.config.appearance.themeJS) {