diff --git a/dashboard/src/i18n/locales/en-US/features/settings.json b/dashboard/src/i18n/locales/en-US/features/settings.json index c6f5e24d6..0e2454716 100644 --- a/dashboard/src/i18n/locales/en-US/features/settings.json +++ b/dashboard/src/i18n/locales/en-US/features/settings.json @@ -39,25 +39,16 @@ "subtitle": "Customize theme primary and secondary colors. Changes apply immediately and are stored locally in your browser.", "customize": { "title": "Theme Colors", + "colors": "Custom Colors", "preset": "Color Scheme", "primary": "Primary Color", "secondary": "Secondary Color", "reset": "Reset to Default", - "presetApplied": "Theme applied" - } - }, - "style": { - "title": "Theme", - "color": { - "title": "Theme Colors", - "subtitle": "Customize theme primary and secondary colors. Changes apply immediately and are stored locally in your browser.", - "primary": "Primary Color", - "secondary": "Secondary Color" - }, - "autoSync": { - "title": "Auto-Switch Light/Dark Theme", - "subtitle": "Automatically switch between light and dark themes based on your system's appearance setting.", - "label": "Enable Auto-Switch" + "presetApplied": "Theme applied", + "light": "Light Mode", + "dark": "Dark Mode", + "auto": "System Mode", + "autoSwitchDesc": "Theme will automatically switch based on your browser's appearance setting when enable system mode" } }, "reset": { diff --git a/dashboard/src/i18n/locales/zh-CN/features/settings.json b/dashboard/src/i18n/locales/zh-CN/features/settings.json index 6fe647495..59f10f7ac 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/settings.json +++ b/dashboard/src/i18n/locales/zh-CN/features/settings.json @@ -44,21 +44,11 @@ "primary": "主色", "secondary": "辅助色", "reset": "恢复默认", - "presetApplied": "主题已应用" - } - }, - "style": { - "title": "主题", - "color": { - "title": "主题颜色", - "subtitle": "自定义主题主色与辅助色。修改后立即生效,并保存在浏览器本地。", - "primary": "主色", - "secondary": "辅助色" - }, - "autoSync": { - "title": "自动切换深色主题", - "subtitle": "根据您的浏览器外观设置自动切换主题", - "label": "启用自动切换" + "presetApplied": "主题已应用", + "light": "浅色", + "dark": "深色", + "auto": "系统", + "autoSwitchDesc": "应用系统主题后,主题将根据您的浏览器外观设置自动切换" } }, "reset": { diff --git a/dashboard/src/views/Settings.vue b/dashboard/src/views/Settings.vue index ca94b835e..aecbc2161 100644 --- a/dashboard/src/views/Settings.vue +++ b/dashboard/src/views/Settings.vue @@ -32,7 +32,7 @@ {{ tm("theme.subtitle") }} -
+
mdi-white-balance-sunny - 亮色 + {{ tm("theme.customize.light")}} mdi-moon-waning-crescent - 暗色 + {{ tm("theme.customize.dark")}} + + + mdi-sync + {{ tm("theme.customize.auto")}} + + + {{ tm("theme.customize.autoSwitchDesc") }} +
- +
{{ tm("theme.customize.colors") }}
@@ -344,14 +358,24 @@ const toastStore = useToastStore(); const theme = useTheme(); const customizer = useCustomizerStore(); -// Theme mode toggle (light/dark) -const isDarkMode = ref(customizer.isDarkTheme ? "dark" : "light"); +// Theme mode toggle (light/dark/auto) +const themeMode = computed({ + get() { + if (customizer.autoSwitchTheme) return "auto"; + return customizer.isDarkTheme ? "dark" : "light"; + }, + set(mode: string) { + if (mode === "auto") { + customizer.SET_AUTO_SYNC(true); + customizer.APPLY_SYSTEM_THEME(); + return; + } -const toggleThemeMode = (mode: string) => { - const newTheme = mode === "dark" ? DARK_THEME_NAME : LIGHT_THEME_NAME; - customizer.SET_UI_THEME(newTheme); - vuetify.theme.change(newTheme); -}; + customizer.SET_AUTO_SYNC(false); + const newTheme = mode === "dark" ? DARK_THEME_NAME : LIGHT_THEME_NAME; + customizer.SET_UI_THEME(newTheme); + }, +}); const getStoredColor = (key, fallback) => { const stored =