mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
596104cc68
* feat: static getDesignToken * chore: code clean
18 lines
665 B
TypeScript
18 lines
665 B
TypeScript
import { createTheme, getComputedToken } from '@ant-design/cssinjs';
|
|
import type { ThemeConfig } from '../config-provider/context';
|
|
import type { AliasToken } from './interface';
|
|
import defaultDerivative from './themes/default';
|
|
import seedToken from './themes/seed';
|
|
import formatToken from './util/alias';
|
|
|
|
const getDesignToken = (config?: ThemeConfig): AliasToken => {
|
|
const theme = config?.algorithm ? createTheme(config.algorithm) : createTheme(defaultDerivative);
|
|
const mergedToken = {
|
|
...seedToken,
|
|
...config?.token,
|
|
};
|
|
return getComputedToken(mergedToken, { override: config?.token }, theme, formatToken);
|
|
};
|
|
|
|
export default getDesignToken;
|