diff --git a/src/App.vue b/src/App.vue index 6b44b0f..262c44e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,9 @@ diff --git a/src/assets/global.css b/src/assets/global.css index d84c341..7aec021 100644 --- a/src/assets/global.css +++ b/src/assets/global.css @@ -31,4 +31,21 @@ --set-item-title-size: 14px; --set-item-desc-size: 12px; +} + +/* 深色主题:通过根节点 data-theme="dark" 覆盖同名变量 */ +:root[data-theme="dark"] { + --color-window-bg: #1b1c20; + --color-surface: #26272e; + --color-surface-hover: #30323b; + + --color-text-primary: #f0f1f5; + --color-text-secondary: #9aa0ab; + --color-text-invert: #1d1d1f; + + --color-border: rgba(255, 255, 255, 0.08); + --color-border-hover: rgba(102, 126, 234, 0.5); + --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35); + --shadow-card-hover: 0 10px 28px rgba(0, 0, 0, 0.5); + --shadow-focus: 0 4px 16px rgba(102, 126, 234, 0.3); } \ No newline at end of file diff --git a/src/layout/MainLayout.vue b/src/layout/MainLayout.vue index 92650f0..61c7a3f 100644 --- a/src/layout/MainLayout.vue +++ b/src/layout/MainLayout.vue @@ -23,9 +23,13 @@ const isMacos = navigator.userAgent.includes("Mac OS X") .container { width: 100vw; height: 100vh; - background: rgba(255, 255, 255, 1); + background: var(--color-window-bg); backdrop-filter: blur(20px); - border: 1px solid rgba(255, 255, 255, 0.2); + border: 1px solid var(--color-border); + + :deep(.n-layout) { + background: transparent; + } } .header { @@ -35,6 +39,6 @@ const isMacos = navigator.userAgent.includes("Mac OS X") .content { background: transparent; - height: calc(100vh - 40px); + height: calc(100vh - var(--titlebar-height)); } diff --git a/src/views/setting/Appearance.vue b/src/views/setting/Appearance.vue index b60680b..828a854 100644 --- a/src/views/setting/Appearance.vue +++ b/src/views/setting/Appearance.vue @@ -38,6 +38,10 @@ const settingStore = useSettingStore() const theme = ref(settingStore.appearance.theme) const showShadow = ref(settingStore.appearance.showShadow) +watch(theme, (newVal) => { + settingStore.appearance.theme = newVal +}) + watch(showShadow, (newVal) => { settingStore.appearance.showShadow = newVal getCurrentWindow().setShadow(newVal)