feat(theme): 添加主题配置文件并集成到应用中

This commit is contained in:
dayjoy
2025-05-06 14:22:07 +08:00
parent ceb48abc16
commit f3fbbcc4ab
2 changed files with 14 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import { useAppSelector } from './hooks';
import * as langs from './langs';
import globalMessage from './message';
import { store } from './store';
import appTheme from './theme';
const { darkAlgorithm } = theme;
@@ -34,13 +35,14 @@ const AppInternal: React.FC<{ router: Router }> = (props) => {
const themeConfig = useMemo(() => {
return {
algorithm: theme === Theme.DARK ? [darkAlgorithm] : [],
cssVar: true,
algorithm: (theme === Theme.DARK ? [darkAlgorithm] : []).concat(appTheme.algorithm ?? []),
cssVar: appTheme.cssVar ?? true,
token: primaryColor
? {
colorPrimary: primaryColor,
}
: undefined,
colorPrimary: primaryColor,
...appTheme.token,
}
: appTheme.token,
};
}, [primaryColor, theme]);

7
src/app/theme.ts Normal file
View File

@@ -0,0 +1,7 @@
import { ThemeConfig, theme } from '@toco-design/components';
const appTheme: ThemeConfig = {
};
export default appTheme;