From d5a210f53fa22615c9488d14a41af17812f53fb4 Mon Sep 17 00:00:00 2001 From: Vben Date: Mon, 14 Oct 2024 23:24:21 +0800 Subject: [PATCH] fix: default theme colors cannot be overridden (#4636) * fix: default theme colors cannot be overridden * chore: update default config --- .../preferences/__tests__/__snapshots__/config.test.ts.snap | 2 +- packages/@core/preferences/src/config.ts | 3 +-- packages/@core/preferences/src/update-css-variables.ts | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap b/packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap index 70868234..def5ff60 100644 --- a/packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap +++ b/packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap @@ -93,7 +93,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj "mode": "dark", "radius": "0.5", "semiDarkHeader": false, - "semiDarkSidebar": true, + "semiDarkSidebar": false, }, "transition": { "enable": true, diff --git a/packages/@core/preferences/src/config.ts b/packages/@core/preferences/src/config.ts index 2d685042..2ee0deaf 100644 --- a/packages/@core/preferences/src/config.ts +++ b/packages/@core/preferences/src/config.ts @@ -82,7 +82,6 @@ const defaultPreferences: Preferences = { showIcon: true, showMaximize: true, showMore: true, - styleType: 'chrome', }, theme: { @@ -94,7 +93,7 @@ const defaultPreferences: Preferences = { mode: 'dark', radius: '0.5', semiDarkHeader: false, - semiDarkSidebar: true, + semiDarkSidebar: false, }, transition: { enable: true, diff --git a/packages/@core/preferences/src/update-css-variables.ts b/packages/@core/preferences/src/update-css-variables.ts index ae6f7e5e..0d3466a0 100644 --- a/packages/@core/preferences/src/update-css-variables.ts +++ b/packages/@core/preferences/src/update-css-variables.ts @@ -18,7 +18,7 @@ function updateCSSVariables(preferences: Preferences) { const theme = preferences?.theme ?? {}; - const { builtinType, colorPrimary, mode, radius } = theme; + const { builtinType, mode, radius } = theme; // html 设置 dark 类 if (Reflect.has(theme, 'mode')) { @@ -58,7 +58,7 @@ function updateCSSVariables(preferences: Preferences) { Reflect.has(theme, 'colorSuccess') || Reflect.has(theme, 'colorWarning') ) { - preferences.theme.colorPrimary = builtinTypeColorPrimary || colorPrimary; + // preferences.theme.colorPrimary = builtinTypeColorPrimary || colorPrimary; updateMainColorVariables(preferences); }