feat(theme): 添加主题配置文件并集成到应用中
This commit is contained in:
@@ -12,6 +12,7 @@ import { useAppSelector } from './hooks';
|
|||||||
import * as langs from './langs';
|
import * as langs from './langs';
|
||||||
import globalMessage from './message';
|
import globalMessage from './message';
|
||||||
import { store } from './store';
|
import { store } from './store';
|
||||||
|
import appTheme from './theme';
|
||||||
|
|
||||||
const { darkAlgorithm } = theme;
|
const { darkAlgorithm } = theme;
|
||||||
|
|
||||||
@@ -34,13 +35,14 @@ const AppInternal: React.FC<{ router: Router }> = (props) => {
|
|||||||
|
|
||||||
const themeConfig = useMemo(() => {
|
const themeConfig = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
algorithm: theme === Theme.DARK ? [darkAlgorithm] : [],
|
algorithm: (theme === Theme.DARK ? [darkAlgorithm] : []).concat(appTheme.algorithm ?? []),
|
||||||
cssVar: true,
|
cssVar: appTheme.cssVar ?? true,
|
||||||
token: primaryColor
|
token: primaryColor
|
||||||
? {
|
? {
|
||||||
colorPrimary: primaryColor,
|
colorPrimary: primaryColor,
|
||||||
|
...appTheme.token,
|
||||||
}
|
}
|
||||||
: undefined,
|
: appTheme.token,
|
||||||
};
|
};
|
||||||
}, [primaryColor, theme]);
|
}, [primaryColor, theme]);
|
||||||
|
|
||||||
|
|||||||
7
src/app/theme.ts
Normal file
7
src/app/theme.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { ThemeConfig, theme } from '@toco-design/components';
|
||||||
|
|
||||||
|
const appTheme: ThemeConfig = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export default appTheme;
|
||||||
Reference in New Issue
Block a user