diff --git a/packages/core/client/src/css-variable/CSSVariableProvider.tsx b/packages/core/client/src/css-variable/CSSVariableProvider.tsx index e4c49a035..788e62ca4 100644 --- a/packages/core/client/src/css-variable/CSSVariableProvider.tsx +++ b/packages/core/client/src/css-variable/CSSVariableProvider.tsx @@ -1,5 +1,6 @@ import { TinyColor } from '@ctrl/tinycolor'; import { useEffect, useMemo } from 'react'; +import { defaultTheme } from '../global-theme'; import { useToken } from '../style'; const CSSVariableProvider = ({ children }) => { @@ -38,9 +39,15 @@ const CSSVariableProvider = ({ children }) => { document.body.style.setProperty('--colorBgScrollBarHover', colorBgScrollBarHover); document.body.style.setProperty('--colorBgScrollBarActive', colorBgScrollBarActive); document.body.style.setProperty('--colorBgDrawer', colorBgDrawer); - document.body.style.setProperty('--colorSettings', token.colorSettings); - document.body.style.setProperty('--colorBgSettingsHover', token.colorBgSettingsHover); - document.body.style.setProperty('--colorBorderSettingsHover', token.colorBorderSettingsHover); + document.body.style.setProperty('--colorSettings', token.colorSettings || defaultTheme.token.colorSettings); + document.body.style.setProperty( + '--colorBgSettingsHover', + token.colorBgSettingsHover || defaultTheme.token.colorBgSettingsHover, + ); + document.body.style.setProperty( + '--colorBorderSettingsHover', + token.colorBorderSettingsHover || defaultTheme.token.colorBorderSettingsHover, + ); // 设置登录页面的背景色 document.body.style.setProperty('background-color', token.colorBgContainer); diff --git a/packages/plugins/theme-editor/src/client/components/ToEditTheme.tsx b/packages/plugins/theme-editor/src/client/components/ToEditTheme.tsx index c175b0875..df632e176 100644 --- a/packages/plugins/theme-editor/src/client/components/ToEditTheme.tsx +++ b/packages/plugins/theme-editor/src/client/components/ToEditTheme.tsx @@ -24,6 +24,7 @@ const ToEditTheme = () => {