From 06a6c947a980530be6654f05357bc3c721c1140b Mon Sep 17 00:00:00 2001 From: zhang Date: Mon, 30 Oct 2023 08:14:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(style):=20=E4=BF=AE=E5=A4=8D=E9=BB=91?= =?UTF-8?q?=E6=9A=97=E6=A8=A1=E5=BC=8F=E4=B8=8B=E5=BC=B9=E6=A1=86=E3=80=81?= =?UTF-8?q?demo=E7=9B=AE=E5=BD=95=E4=B8=8B=E3=80=81=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=20(#3208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除黑暗模式下冗余的样式代码 --- internal/vite-config/src/utils/modifyVars.ts | 5 - .../Application/src/AppDarkModeToggle.vue | 17 +- src/components/Modal/src/index.less | 12 +- src/design/ant/btn.less | 18 +- src/design/color.less | 26 +- src/design/dark.less | 1490 ++--------------- src/layouts/default/header/index.less | 2 +- src/logics/initAppConfig.ts | 13 +- src/logics/theme/updateBackground.ts | 123 ++ src/views/demo/page/form/step/Step1.vue | 6 +- src/views/demo/page/list/basic/index.vue | 4 +- src/views/demo/page/list/card/index.vue | 2 +- src/views/sys/login/Login.vue | 21 +- 13 files changed, 313 insertions(+), 1426 deletions(-) diff --git a/internal/vite-config/src/utils/modifyVars.ts b/internal/vite-config/src/utils/modifyVars.ts index 1d00b7da325..0554343cb05 100644 --- a/internal/vite-config/src/utils/modifyVars.ts +++ b/internal/vite-config/src/utils/modifyVars.ts @@ -7,7 +7,6 @@ import { theme } from 'ant-design-vue/lib'; import convertLegacyToken from 'ant-design-vue/lib/theme/convertLegacyToken'; const { defaultAlgorithm, defaultSeed } = theme; - const primaryColor = '#0960bd'; function generateAntColors(color: string, theme: 'default' | 'dark' = 'default') { @@ -22,17 +21,14 @@ function generateAntColors(color: string, theme: 'default' | 'dark' = 'default') export function generateModifyVars() { const palettes = generateAntColors(primaryColor); const primary = palettes[5]; - const primaryColorObj: Record = {}; for (let index = 0; index < 10; index++) { primaryColorObj[`primary-${index + 1}`] = palettes[index]; } - // const modifyVars = getThemeVariables(); const mapToken = defaultAlgorithm(defaultSeed); const v3Token = convertLegacyToken(mapToken); - return { ...v3Token, // reference: Avoid repeated references @@ -47,6 +43,5 @@ export function generateModifyVars() { 'font-size-base': '14px', // Main font size 'border-radius-base': '2px', // Component/float fillet 'link-color': primary, // Link color - 'app-content-background': '#fafafa', // Link color }; } diff --git a/src/components/Application/src/AppDarkModeToggle.vue b/src/components/Application/src/AppDarkModeToggle.vue index 6ab8c402b12..3a851786e62 100644 --- a/src/components/Application/src/AppDarkModeToggle.vue +++ b/src/components/Application/src/AppDarkModeToggle.vue @@ -10,7 +10,14 @@ import { SvgIcon } from '/@/components/Icon'; import { useDesign } from '/@/hooks/web/useDesign'; import { useRootSetting } from '/@/hooks/setting/useRootSetting'; - import { updateHeaderBgColor, updateSidebarBgColor } from '/@/logics/theme/updateBackground'; + import { + updateTextColor, + updateBorderColor, + updateHeaderBgColor, + updateSidebarBgColor, + updateComponentBgColor, + updateAppContentBgColor, + } from '/@/logics/theme/updateBackground'; import { updateDarkTheme } from '/@/logics/theme/dark'; import { ThemeEnum } from '/@/enums/appEnum'; @@ -30,8 +37,12 @@ const darkMode = getDarkMode.value === ThemeEnum.DARK ? ThemeEnum.LIGHT : ThemeEnum.DARK; setDarkMode(darkMode); updateDarkTheme(darkMode); + updateTextColor(); + updateBorderColor(); updateHeaderBgColor(); updateSidebarBgColor(); + updateComponentBgColor(); + updateAppContentBgColor(); }