refactor: token update (#36373)

* refactor: update seed

* refactor: update token

* test: update

* chore: update

* chore: code clean
This commit is contained in:
MadCcc 2022-07-05 10:35:44 +08:00 committed by GitHub
parent 469d0bc81c
commit 8c7a9c97e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 13 deletions

View File

@ -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}`,

View File

@ -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,

View File

@ -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],

View File

@ -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,

View File

@ -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],

View File

@ -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,