mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
refactor: token update (#36373)
* refactor: update seed * refactor: update token * test: update * chore: update * chore: code clean
This commit is contained in:
parent
469d0bc81c
commit
8c7a9c97e6
@ -181,7 +181,7 @@ const genDefaultButtonStyle: GenerateStyle<ButtonToken, CSSObject> = token => ({
|
||||
const genPrimaryButtonStyle: GenerateStyle<ButtonToken, CSSObject> = token => ({
|
||||
...genSolidButtonStyle(token),
|
||||
|
||||
color: '#FFF',
|
||||
color: token.colorTextLightSolid,
|
||||
backgroundColor: token.colorPrimary,
|
||||
|
||||
boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorPrimaryOutline}`,
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
} from './palettes';
|
||||
|
||||
export default function derivative(token: SeedToken): MapToken {
|
||||
const { colorPrimary, colorSuccess, colorWarning, colorError, colorInfo } = token;
|
||||
const { colorSuccess, colorWarning, colorError, colorInfo } = token;
|
||||
|
||||
const colorPalettes = Object.keys(defaultPresetColors)
|
||||
.map((colorKey: keyof PresetColorType) => {
|
||||
@ -34,18 +34,22 @@ export default function derivative(token: SeedToken): MapToken {
|
||||
return prev;
|
||||
}, {} as ColorPalettes);
|
||||
|
||||
const colorPrimary = token.colorPrimary || '#177ddc';
|
||||
const colorBgBase = token.colorBgBase || '#000';
|
||||
const colorTextBase = token.colorTextBase || '#fff';
|
||||
|
||||
const primaryColors = generatePrimaryPalettes(colorPrimary);
|
||||
const successColors = generateSuccessPalettes(colorSuccess);
|
||||
const warningColors = generateWarningPalettes(colorWarning);
|
||||
const errorColors = generateErrorPalettes(colorError);
|
||||
const infoColors = generateInfoPalettes(colorInfo);
|
||||
const bgColors = generateBgPalettes('#000');
|
||||
const textColors = generateTextAlphaPalettes('#fff');
|
||||
const bgColors = generateBgPalettes(colorBgBase);
|
||||
const textColors = generateTextAlphaPalettes(colorTextBase);
|
||||
|
||||
return {
|
||||
...token,
|
||||
...colorPalettes,
|
||||
|
||||
colorPrimary,
|
||||
// Colors
|
||||
...genColorMapToken({
|
||||
primaryPalettes: primaryColors,
|
||||
|
@ -13,7 +13,7 @@ import { getAlphaColor, getSolidColor } from './colorAlgorithm';
|
||||
export function generatePrimaryPalettes(primaryBaseColor: string): PrimaryPalettes {
|
||||
const primaryColors = generate(primaryBaseColor, { theme: 'dark' });
|
||||
return {
|
||||
0: primaryBaseColor,
|
||||
0: '#0e161f',
|
||||
1: primaryColors[0],
|
||||
2: primaryColors[1],
|
||||
3: primaryColors[2],
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
} from './palettes';
|
||||
|
||||
export default function derivative(token: SeedToken): MapToken {
|
||||
const { colorPrimary, colorSuccess, colorWarning, colorError, colorInfo, colorBgBase } = token;
|
||||
const { colorSuccess, colorWarning, colorError, colorInfo } = token;
|
||||
|
||||
const colorPalettes = Object.keys(defaultPresetColors)
|
||||
.map((colorKey: keyof PresetColorType) => {
|
||||
@ -34,18 +34,22 @@ export default function derivative(token: SeedToken): MapToken {
|
||||
return prev;
|
||||
}, {} as ColorPalettes);
|
||||
|
||||
const colorPrimary = token.colorPrimary || '#1890ff';
|
||||
const colorBgBase = token.colorBgBase || '#fff';
|
||||
const colorTextBase = token.colorTextBase || '#000';
|
||||
|
||||
const primaryColors = generatePrimaryPalettes(colorPrimary);
|
||||
const successColors = generateSuccessPalettes(colorSuccess);
|
||||
const warningColors = generateWarningPalettes(colorWarning);
|
||||
const errorColors = generateErrorPalettes(colorError);
|
||||
const infoColors = generateInfoPalettes(colorInfo);
|
||||
const bgColors = generateBgPalettes(colorBgBase);
|
||||
const textColors = generateTextAlphaPalettes('#000');
|
||||
const textColors = generateTextAlphaPalettes(colorTextBase);
|
||||
|
||||
return {
|
||||
...token,
|
||||
...colorPalettes,
|
||||
|
||||
colorPrimary,
|
||||
// Colors
|
||||
...genColorMapToken({
|
||||
primaryPalettes: primaryColors,
|
||||
|
@ -13,7 +13,7 @@ import { getAlphaColor, getSolidColor } from './colorAlgorithm';
|
||||
export function generatePrimaryPalettes(primaryBaseColor: string): PrimaryPalettes {
|
||||
const primaryColors = generate(primaryBaseColor);
|
||||
return {
|
||||
0: '#0e161f',
|
||||
0: primaryBaseColor,
|
||||
1: primaryColors[0],
|
||||
2: primaryColors[1],
|
||||
3: primaryColors[2],
|
||||
|
@ -21,15 +21,15 @@ const seedToken: SeedToken = {
|
||||
...defaultPresetColors,
|
||||
|
||||
// Color
|
||||
colorPrimary: '#1890ff',
|
||||
colorPrimary: '',
|
||||
colorSuccess: '#52c41a',
|
||||
colorWarning: '#faad14',
|
||||
colorError: '#ff4d4f',
|
||||
colorInfo: '#1890ff',
|
||||
colorTextBase: '#000',
|
||||
colorTextBase: '',
|
||||
colorTextLightSolid: '#fff',
|
||||
|
||||
colorBgBase: '#fff',
|
||||
colorBgBase: '',
|
||||
|
||||
// Font
|
||||
fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
||||
|
Loading…
Reference in New Issue
Block a user