refactor: token update (#36637)

* refactor: token update

* refactor: token

* chore: error color

* fix: menu danger
This commit is contained in:
MadCcc 2022-07-21 17:00:42 +08:00 committed by GitHub
parent 45ea8e0a5c
commit 1ad0553249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 301 additions and 359 deletions

View File

@ -179,8 +179,8 @@ export const genActionStyle: GenerateStyle<AlertToken> = (token: AlertToken): CS
motionDurationSlow: duration, motionDurationSlow: duration,
marginXS, marginXS,
fontSizeIcon, fontSizeIcon,
colorAction, colorIcon,
colorActionHover, colorIconHover,
} = token; } = token;
return { return {
@ -201,19 +201,19 @@ export const genActionStyle: GenerateStyle<AlertToken> = (token: AlertToken): CS
cursor: 'pointer', cursor: 'pointer',
[`${iconCls}-close`]: { [`${iconCls}-close`]: {
color: colorAction, color: colorIcon,
transition: `color ${duration}`, transition: `color ${duration}`,
'&:hover': { '&:hover': {
color: colorActionHover, color: colorIconHover,
}, },
}, },
}, },
'&-close-text': { '&-close-text': {
color: colorAction, color: colorIcon,
transition: `color ${duration}`, transition: `color ${duration}`,
'&:hover': { '&:hover': {
color: colorActionHover, color: colorIconHover,
}, },
}, },
}, },

View File

@ -183,7 +183,7 @@ const genPrimaryButtonStyle: GenerateStyle<ButtonToken, CSSObject> = token => ({
color: token.colorTextLightSolid, color: token.colorTextLightSolid,
backgroundColor: token.colorPrimary, backgroundColor: token.colorPrimary,
boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorPrimaryOutline}`, boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlOutline}`,
...genHoverActiveButtonStyle( ...genHoverActiveButtonStyle(
{ {
@ -376,11 +376,11 @@ const genSizeLargeButtonStyle: GenerateStyle<ButtonToken> = token => {
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Button', token => { export default genComponentStyleHook('Button', token => {
const { buttonColorBgTextHover, buttonColorBgTextActive, controlTmpOutline } = token; const { controlTmpOutline, colorTextQuaternary, colorTextTertiary } = token;
const buttonToken = mergeToken<ButtonToken>(token, { const buttonToken = mergeToken<ButtonToken>(token, {
colorBgTextHover: buttonColorBgTextHover, colorBgTextHover: colorTextQuaternary,
colorBgTextActive: buttonColorBgTextActive, colorBgTextActive: colorTextTertiary,
colorOutlineDefault: controlTmpOutline, colorOutlineDefault: controlTmpOutline,
}); });

View File

@ -193,12 +193,12 @@ const genCardMetaStyle: GenerateStyle<CardToken> = (token): CSSObject => ({
// ============================== Inner ============================== // ============================== Inner ==============================
const genCardTypeInnerStyle: GenerateStyle<CardToken> = (token): CSSObject => { const genCardTypeInnerStyle: GenerateStyle<CardToken> = (token): CSSObject => {
const { componentCls, cardPaddingBase, colorBgContainerSecondary, cardInnerHeadPadding } = token; const { componentCls, cardPaddingBase, colorFillAlter, cardInnerHeadPadding } = token;
return { return {
[`${componentCls}-head`]: { [`${componentCls}-head`]: {
padding: `0 ${cardPaddingBase}px`, padding: `0 ${cardPaddingBase}px`,
background: colorBgContainerSecondary, background: colorFillAlter,
'&-title': { '&-title': {
padding: `${cardInnerHeadPadding}px 0`, padding: `${cardInnerHeadPadding}px 0`,

View File

@ -238,7 +238,7 @@ export default genComponentStyleHook('Collapse', token => {
const collapseToken = mergeToken<CollapseToken>(token, { const collapseToken = mergeToken<CollapseToken>(token, {
collapseContentBg: token.colorBgContainer, collapseContentBg: token.colorBgContainer,
collapseContentPadding: token.padding, collapseContentPadding: token.padding,
collapseHeaderBg: token.colorBgContainerSecondary, collapseHeaderBg: token.colorFillAlter,
collapseHeaderPadding: `${token.paddingSM}px ${token.padding}px`, collapseHeaderPadding: `${token.paddingSM}px ${token.padding}px`,
collapsePanelBorderRadius: token.radiusBase, collapsePanelBorderRadius: token.radiusBase,
}); });

View File

@ -315,7 +315,7 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
button: { button: {
padding: 0, padding: 0,
color: token.colorAction, color: token.colorIcon,
lineHeight: `${token.pickerTextHeight}px`, lineHeight: `${token.pickerTextHeight}px`,
background: 'transparent', background: 'transparent',
border: 0, border: 0,
@ -328,7 +328,7 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
fontSize: token.fontSize, fontSize: token.fontSize,
'&:hover': { '&:hover': {
color: token.colorActionHover, color: token.colorIconHover,
}, },
}, },
@ -788,7 +788,7 @@ const genPickerStatusStyle: GenerateStyle<PickerToken> = token => {
mergeToken<PickerToken>(token, { mergeToken<PickerToken>(token, {
inputBorderActiveColor: token.colorError, inputBorderActiveColor: token.colorError,
inputBorderHoverColor: token.colorError, inputBorderHoverColor: token.colorError,
colorPrimaryOutline: token.colorErrorOutline, controlOutline: token.colorErrorOutline,
}), }),
), ),
}, },
@ -809,7 +809,7 @@ const genPickerStatusStyle: GenerateStyle<PickerToken> = token => {
mergeToken<PickerToken>(token, { mergeToken<PickerToken>(token, {
inputBorderActiveColor: token.colorWarning, inputBorderActiveColor: token.colorWarning,
inputBorderHoverColor: token.colorWarning, inputBorderHoverColor: token.colorWarning,
colorPrimaryOutline: token.colorWarningOutline, controlOutline: token.colorWarningOutline,
}), }),
), ),
}, },

View File

@ -184,7 +184,7 @@ const genDescriptionStyles: GenerateStyle<DescriptionsToken> = (token: Descripti
}; };
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Descriptions', token => { export default genComponentStyleHook('Descriptions', token => {
const descriptionsBg = token.colorBgContainerSecondary; const descriptionsBg = token.colorFillAlter;
const descriptionsTitleMarginBottom = token.fontSizeSM * token.lineHeightSM; const descriptionsTitleMarginBottom = token.fontSizeSM * token.lineHeightSM;
const descriptionsExtraColor = token.colorText; const descriptionsExtraColor = token.colorText;
const descriptionsSmallPadding = `${token.paddingXS}px ${token.padding}px`; const descriptionsSmallPadding = `${token.paddingXS}px ${token.padding}px`;

View File

@ -87,7 +87,7 @@ const genBaseStyle: GenerateStyle<DrawerToken> = (token: DrawerToken): CSSObject
[`${componentCls}-close`]: { [`${componentCls}-close`]: {
display: 'inline-block', display: 'inline-block',
marginInlineEnd: token.marginSM, marginInlineEnd: token.marginSM,
color: token.colorAction, color: token.colorIcon,
fontWeight: token.fontWeightStrong, fontWeight: token.fontWeightStrong,
fontSize: fontSizeLG, fontSize: fontSizeLG,
fontStyle: 'normal', fontStyle: 'normal',
@ -103,7 +103,7 @@ const genBaseStyle: GenerateStyle<DrawerToken> = (token: DrawerToken): CSSObject
textRendering: 'auto', textRendering: 'auto',
[`&:focus, &:hover`]: { [`&:focus, &:hover`]: {
color: token.colorActionHover, color: token.colorIconHover,
textDecoration: 'none', textDecoration: 'none',
}, },
}, },

View File

@ -55,7 +55,7 @@ const resetForm = (token: AliasToken): CSSObject => ({
input[type='radio']:focus, input[type='radio']:focus,
input[type='checkbox']:focus`]: { input[type='checkbox']:focus`]: {
outline: 0, outline: 0,
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.colorPrimaryOutline}`, boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
}, },
// Adjust output element // Adjust output element

View File

@ -204,7 +204,7 @@ const genInputNumberStyles: GenerateStyle<InputNumberToken> = (token: InputNumbe
borderInlineStart: `${controlLineWidth}px ${controlLineType} ${colorBorder}`, borderInlineStart: `${controlLineWidth}px ${controlLineType} ${colorBorder}`,
transition: `all ${motionDurationFast} linear`, transition: `all ${motionDurationFast} linear`,
'&:active': { '&:active': {
background: token.colorBgContainerSecondary, background: token.colorFillAlter,
}, },
// Hover // Hover

View File

@ -36,7 +36,7 @@ export const genHoverStyle = (token: InputToken): CSSObject => ({
export const genActiveStyle = (token: InputToken) => ({ export const genActiveStyle = (token: InputToken) => ({
borderColor: token.inputBorderHoverColor, borderColor: token.inputBorderHoverColor,
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.colorPrimaryOutline}`, boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
borderInlineEndWidth: token.controlLineWidth, borderInlineEndWidth: token.controlLineWidth,
outline: 0, outline: 0,
}); });
@ -81,7 +81,7 @@ export const genStatusStyle = (token: InputToken): CSSObject => {
mergeToken<InputToken>(token, { mergeToken<InputToken>(token, {
inputBorderActiveColor: colorError, inputBorderActiveColor: colorError,
inputBorderHoverColor: colorError, inputBorderHoverColor: colorError,
colorPrimaryOutline: colorErrorOutline, controlOutline: colorErrorOutline,
}), }),
), ),
}, },
@ -100,7 +100,7 @@ export const genStatusStyle = (token: InputToken): CSSObject => {
mergeToken<InputToken>(token, { mergeToken<InputToken>(token, {
inputBorderActiveColor: colorWarning, inputBorderActiveColor: colorWarning,
inputBorderHoverColor: colorWarning, inputBorderHoverColor: colorWarning,
colorPrimaryOutline: colorWarningOutline, controlOutline: colorWarningOutline,
}), }),
), ),
}, },
@ -247,7 +247,7 @@ export const genInputGroupStyle = (token: InputToken): CSSObject => {
fontWeight: 'normal', fontWeight: 'normal',
fontSize: token.fontSize, fontSize: token.fontSize,
textAlign: 'center', textAlign: 'center',
backgroundColor: token.colorBgContainerSecondary, backgroundColor: token.colorFillAlter,
border: `${token.controlLineWidth}px ${token.controlLineType} ${token.colorBorder}`, border: `${token.controlLineWidth}px ${token.controlLineType} ${token.colorBorder}`,
borderRadius: token.controlRadius, borderRadius: token.controlRadius,
transition: `all ${token.motionDurationSlow}`, transition: `all ${token.motionDurationSlow}`,
@ -515,7 +515,7 @@ const genAllowClearStyle = (token: InputToken): CSSObject => {
// ========================= Input ========================= // ========================= Input =========================
[`.${prefixCls}-clear-icon`]: { [`.${prefixCls}-clear-icon`]: {
margin: 0, margin: 0,
color: token.colorAction, color: token.colorIcon,
fontSize: token.fontSizeIcon, fontSize: token.fontSizeIcon,
verticalAlign: -1, verticalAlign: -1,
// https://github.com/ant-design/ant-design/pull/18151 // https://github.com/ant-design/ant-design/pull/18151
@ -561,8 +561,8 @@ const genAffixStyle: GenerateStyle<InputToken> = (token: InputToken) => {
inputAffixPadding, inputAffixPadding,
colorTextSecondary, colorTextSecondary,
motionDurationSlow, motionDurationSlow,
colorAction, colorIcon,
colorActionHover, colorIconHover,
iconCls, iconCls,
} = token; } = token;
@ -637,12 +637,12 @@ const genAffixStyle: GenerateStyle<InputToken> = (token: InputToken) => {
// password // password
[`${iconCls}.${prefixCls}-password-icon`]: { [`${iconCls}.${prefixCls}-password-icon`]: {
color: colorAction, color: colorIcon,
cursor: 'pointer', cursor: 'pointer',
transition: `all ${motionDurationSlow}`, transition: `all ${motionDurationSlow}`,
'&:hover': { '&:hover': {
color: colorActionHover, color: colorIconHover,
}, },
}, },

View File

@ -72,7 +72,7 @@ const getBaseStyle: GenerateStyle<MenuToken> = token => {
lineHeight, lineHeight,
paddingXS, paddingXS,
padding, padding,
colorBorderSecondary, colorSplit,
lineWidth, lineWidth,
iconCls, iconCls,
zIndexPopup, zIndexPopup,
@ -182,7 +182,7 @@ const getBaseStyle: GenerateStyle<MenuToken> = token => {
[`${componentCls}-item-divider`]: { [`${componentCls}-item-divider`]: {
overflow: 'hidden', overflow: 'hidden',
lineHeight: 0, lineHeight: 0,
borderColor: colorBorderSecondary, borderColor: colorSplit,
borderStyle: lineType, borderStyle: lineType,
borderTopWidth: lineWidth, borderTopWidth: lineWidth,
marginBlock: lineWidth, marginBlock: lineWidth,
@ -398,12 +398,12 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
colorError, colorError,
colorTextDisabled, colorTextDisabled,
colorErrorHover, colorErrorHover,
colorErrorOutline, colorErrorBg,
colorText, colorText,
colorTextLightSolid, colorTextLightSolid,
colorTextSecondary, colorTextSecondary,
colorBgContainer, colorBgContainer,
colorBgContainerSecondary, colorFillAlter,
controlHeightLG, controlHeightLG,
fontSize, fontSize,
controlItemBgActive, controlItemBgActive,
@ -430,7 +430,7 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
themeColorTextSecondary: colorTextSecondary, themeColorTextSecondary: colorTextSecondary,
themeColorTextSelect: colorPrimary, themeColorTextSelect: colorPrimary,
themeColorBg: colorBgContainer, themeColorBg: colorBgContainer,
themeColorBgSecondary: colorBgContainerSecondary, themeColorBgSecondary: colorFillAlter,
themeColorBgActive: controlItemBgActive, themeColorBgActive: controlItemBgActive,
themeColorBgSelect: controlItemBgActive, themeColorBgSelect: controlItemBgActive,
themeInkBarWidth: lineWidthBold + lineWidth, themeInkBarWidth: lineWidthBold + lineWidth,
@ -444,8 +444,8 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
themeColorDangerText: colorError, themeColorDangerText: colorError,
themeColorDangerTextHover: colorError, themeColorDangerTextHover: colorError,
themeColorDangerTextSelect: colorError, themeColorDangerTextSelect: colorError,
themeColorDangerBgActive: colorErrorOutline, themeColorDangerBgActive: colorErrorBg,
themeColorDangerBgSelect: colorErrorOutline, themeColorDangerBgSelect: colorErrorBg,
}); });
const menuDarkToken = mergeToken<MenuThemeToken>(menuToken, { const menuDarkToken = mergeToken<MenuThemeToken>(menuToken, {

View File

@ -368,7 +368,7 @@ export default genComponentStyleHook('Modal', token => {
modalFooterPaddingHorizontal: token.padding, modalFooterPaddingHorizontal: token.padding,
modalFooterBorderWidth: token.controlLineWidth, modalFooterBorderWidth: token.controlLineWidth,
modalConfirmTitleFontSize: token.fontSizeLG, modalConfirmTitleFontSize: token.fontSizeLG,
modalIconHoverColor: token.colorActionHover, modalIconHoverColor: token.colorIconHover,
modalConfirmIconSize: token.fontSize * token.lineHeight, modalConfirmIconSize: token.fontSize * token.lineHeight,
}); });
return [ return [

View File

@ -222,11 +222,11 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = token => {
position: 'absolute', position: 'absolute',
top: token.notificationPaddingVertical, top: token.notificationPaddingVertical,
insetInlineEnd: token.notificationPaddingHorizontal, insetInlineEnd: token.notificationPaddingHorizontal,
color: token.colorAction, color: token.colorIcon,
outline: 'none', outline: 'none',
'&:hover': { '&:hover': {
color: token.colorActionHover, color: token.colorIconHover,
}, },
}, },

View File

@ -222,7 +222,7 @@ const genPaginationSimpleStyle: GenerateStyle<PaginationToken, CSSObject> = toke
'&:focus': { '&:focus': {
borderColor: token.colorPrimaryHover, borderColor: token.colorPrimaryHover,
boxShadow: `${token.inputOutlineOffset} 0 ${token.controlOutlineWidth} ${token.colorPrimaryOutline}`, boxShadow: `${token.inputOutlineOffset} 0 ${token.controlOutlineWidth} ${token.controlOutline}`,
}, },
'&[disabled]': { '&[disabled]': {

View File

@ -259,7 +259,7 @@ export default genComponentStyleHook('Progress', token => {
progressLineRadius: 100, // magic for capsule shape, should be a very large number progressLineRadius: 100, // magic for capsule shape, should be a very large number
progressInfoTextColor: token.colorText, progressInfoTextColor: token.colorText,
progressDefaultColor: token.colorInfo, progressDefaultColor: token.colorInfo,
progressRemainingColor: token.colorBgContent, progressRemainingColor: token.colorFillSecondary,
progressStepMarginInlineEnd, progressStepMarginInlineEnd,
progressStepMinWidth: progressStepMarginInlineEnd, progressStepMinWidth: progressStepMarginInlineEnd,
progressActiveMotionDuration: '2.4s', progressActiveMotionDuration: '2.4s',

View File

@ -463,7 +463,7 @@ export default genComponentStyleHook('Radio', token => {
fontSize, fontSize,
lineHeight, lineHeight,
fontSizeLG, fontSizeLG,
colorPrimaryOutline, controlOutline,
colorPrimaryHover, colorPrimaryHover,
colorPrimaryActive, colorPrimaryActive,
colorText, colorText,
@ -473,7 +473,7 @@ export default genComponentStyleHook('Radio', token => {
} = token; } = token;
// Radio // Radio
const radioFocusShadow = `0 0 0 ${controlOutlineWidth}px ${colorPrimaryOutline}`; const radioFocusShadow = `0 0 0 ${controlOutlineWidth}px ${controlOutline}`;
const radioButtonFocusShadow = radioFocusShadow; const radioButtonFocusShadow = radioFocusShadow;
const radioSize = fontSizeLG; const radioSize = fontSizeLG;

View File

@ -123,13 +123,13 @@ const genRateStyle: GenerateStyle<RateToken> = token => {
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Rate', token => { export default genComponentStyleHook('Rate', token => {
const { colorBgFillTmp } = token; const { colorFillContent } = token;
const rateToken = mergeToken<RateToken>(token, { const rateToken = mergeToken<RateToken>(token, {
rateStarColor: token['yellow-6'], rateStarColor: token['yellow-6'],
rateStarSize: token.controlHeightLG * 0.5, rateStarSize: token.controlHeightLG * 0.5,
rateStarHoverScale: 'scale(1.1)', rateStarHoverScale: 'scale(1.1)',
defaultColor: colorBgFillTmp, defaultColor: colorFillContent,
}); });
return [genRateStyle(rateToken)]; return [genRateStyle(rateToken)];
}); });

View File

@ -79,7 +79,7 @@ const genBaseStyle: GenerateStyle<ResultToken> = (token): CSSObject => {
[`${componentCls} ${componentCls}-content`]: { [`${componentCls} ${componentCls}-content`]: {
marginTop: paddingLG, marginTop: paddingLG,
padding: `${paddingLG}px ${padding * 2.5}px`, padding: `${paddingLG}px ${padding * 2.5}px`,
backgroundColor: token.colorBgContainerSecondary, backgroundColor: token.colorFillAlter,
}, },
[`${componentCls} ${componentCls}-extra`]: { [`${componentCls} ${componentCls}-extra`]: {

View File

@ -3,12 +3,7 @@ import type { FullToken, GenerateStyle } from '../../theme';
import { genComponentStyleHook, mergeToken } from '../../theme'; import { genComponentStyleHook, mergeToken } from '../../theme';
import { resetComponent } from '../../style'; import { resetComponent } from '../../style';
export interface ComponentToken { export interface ComponentToken {}
// FIXME: need to be removed
bgColor: string;
bgColorHover: string;
bgColorSelected: string;
}
interface SegmentedToken extends FullToken<'Segmented'> { interface SegmentedToken extends FullToken<'Segmented'> {
segmentedPaddingHorizontal: number; segmentedPaddingHorizontal: number;
@ -16,6 +11,9 @@ interface SegmentedToken extends FullToken<'Segmented'> {
segmentedContainerPadding: number; segmentedContainerPadding: number;
labelColor: string; labelColor: string;
labelColorHover: string; labelColorHover: string;
bgColor: string;
bgColorHover: string;
bgColorSelected: string;
} }
// ============================== Mixins ============================== // ============================== Mixins ==============================
@ -168,23 +166,26 @@ const genSegmentedStyle: GenerateStyle<SegmentedToken> = (token: SegmentedToken)
}; };
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook( export default genComponentStyleHook('Segmented', token => {
'Segmented', const {
token => { lineWidthBold,
const { lineWidthBold, controlLineWidth, colorTextLabel, colorText } = token; controlLineWidth,
colorTextLabel,
colorText,
colorFillSecondary,
colorFill,
colorBgContainer,
} = token;
const segmentedToken = mergeToken<SegmentedToken>(token, { const segmentedToken = mergeToken<SegmentedToken>(token, {
segmentedPaddingHorizontal: token.controlPaddingHorizontal - controlLineWidth, segmentedPaddingHorizontal: token.controlPaddingHorizontal - controlLineWidth,
segmentedPaddingHorizontalSM: token.controlPaddingHorizontalSM - controlLineWidth, segmentedPaddingHorizontalSM: token.controlPaddingHorizontalSM - controlLineWidth,
segmentedContainerPadding: lineWidthBold, segmentedContainerPadding: lineWidthBold,
labelColor: colorTextLabel, labelColor: colorTextLabel,
labelColorHover: colorText, labelColorHover: colorText,
}); bgColor: colorFillSecondary,
return [genSegmentedStyle(segmentedToken)]; bgColorHover: colorFill,
}, bgColorSelected: colorBgContainer,
({ segmentedBgColor, segmentedBgColorActive, segmentedBgColorHover }) => ({ });
bgColor: segmentedBgColor, return [genSegmentedStyle(segmentedToken)];
bgColorHover: segmentedBgColorHover, });
bgColorSelected: segmentedBgColorActive,
}),
);

View File

@ -297,7 +297,7 @@ const genSelectStyle: GenerateStyle<SelectToken> = token => {
componentCls, componentCls,
mergeToken<any>(token, { mergeToken<any>(token, {
borderHoverColor: token.colorPrimaryHover, borderHoverColor: token.colorPrimaryHover,
outlineColor: token.colorPrimaryOutline, outlineColor: token.controlOutline,
}), }),
), ),
genStatusStyle( genStatusStyle(

View File

@ -93,7 +93,7 @@ function genSizeStyle(token: SelectToken, suffix?: string): CSSObject {
marginTop: FIXED_ITEM_MARGIN, marginTop: FIXED_ITEM_MARGIN,
marginBottom: FIXED_ITEM_MARGIN, marginBottom: FIXED_ITEM_MARGIN,
lineHeight: `${selectItemHeight - token.controlLineWidth * 2}px`, lineHeight: `${selectItemHeight - token.controlLineWidth * 2}px`,
background: token.colorBgContent, background: token.colorFillSecondary,
border: `${token.controlLineWidth}px solid ${token.colorSplit}`, border: `${token.controlLineWidth}px solid ${token.colorSplit}`,
borderRadius: token.controlRadius, borderRadius: token.controlRadius,
cursor: 'default', cursor: 'default',
@ -122,7 +122,7 @@ function genSizeStyle(token: SelectToken, suffix?: string): CSSObject {
...resetIcon(), ...resetIcon(),
display: 'inline-block', display: 'inline-block',
color: token.colorAction, color: token.colorIcon,
fontWeight: 'bold', fontWeight: 'bold',
fontSize: 10, fontSize: 10,
lineHeight: 'inherit', lineHeight: 'inherit',
@ -133,7 +133,7 @@ function genSizeStyle(token: SelectToken, suffix?: string): CSSObject {
}, },
'&:hover': { '&:hover': {
color: token.colorActionHover, color: token.colorIconHover,
}, },
}, },
}, },

View File

@ -363,10 +363,10 @@ export default genComponentStyleHook(
return [genBaseStyle(skeletonToken)]; return [genBaseStyle(skeletonToken)];
}, },
token => { token => {
const { colorBgFillTmp, colorTextPlaceholder } = token; const { colorFillContent, colorTextPlaceholder } = token;
return { return {
color: colorBgFillTmp, color: colorFillContent,
colorGradientEnd: colorTextPlaceholder, colorGradientEnd: colorTextPlaceholder,
}; };
}, },

View File

@ -34,7 +34,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = token => {
dotSize, dotSize,
marginFull, marginFull,
marginPart, marginPart,
colorBgContentHover, colorFillContentHover,
antCls, antCls,
} = token; } = token;
@ -55,7 +55,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = token => {
[`${componentCls}-rail`]: { [`${componentCls}-rail`]: {
position: 'absolute', position: 'absolute',
backgroundColor: token.colorBgContent, backgroundColor: token.colorFillSecondary,
borderRadius: token.controlRadius, borderRadius: token.controlRadius,
transition: `background-color ${token.motionDurationSlow}`, transition: `background-color ${token.motionDurationSlow}`,
}, },
@ -96,7 +96,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = token => {
'&:hover': { '&:hover': {
[`${componentCls}-rail`]: { [`${componentCls}-rail`]: {
backgroundColor: colorBgContentHover, backgroundColor: colorFillContentHover,
}, },
[`${componentCls}-track`]: { [`${componentCls}-track`]: {
@ -104,7 +104,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = token => {
}, },
[`${componentCls}-dot`]: { [`${componentCls}-dot`]: {
borderColor: colorBgContentHover, borderColor: colorFillContentHover,
}, },
[`${componentCls}-handle${antCls}-tooltip-open`]: { [`${componentCls}-handle${antCls}-tooltip-open`]: {
@ -168,7 +168,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = token => {
cursor: 'not-allowed', cursor: 'not-allowed',
[`${componentCls}-rail`]: { [`${componentCls}-rail`]: {
backgroundColor: `${token.colorBgContent} !important`, backgroundColor: `${token.colorFillSecondary} !important`,
}, },
[`${componentCls}-track`]: { [`${componentCls}-track`]: {

View File

@ -165,7 +165,7 @@ const genSwitchStyle = (token: SwitchToken): CSSObject => {
}, },
[`&${token.componentCls}-checked:focus-visible`]: { [`&${token.componentCls}-checked:focus-visible`]: {
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.colorPrimaryOutline}`, boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
}, },
'&:focus:hover': { '&:focus:hover': {

View File

@ -233,19 +233,19 @@ export default genComponentStyleHook('Table', token => {
paddingXS, paddingXS,
paddingSM, paddingSM,
controlHeight, controlHeight,
colorBgContainerSecondary, colorFillAlter,
colorAction, colorIcon,
colorActionHover, colorIconHover,
opacityLoading, opacityLoading,
colorBgContainer, colorBgContainer,
colorBgContent, colorFillSecondary,
radiusBase, radiusBase,
colorBgFillTmp, colorFillContent,
controlInteractiveSize: checkboxSize, controlInteractiveSize: checkboxSize,
} = token; } = token;
const baseColorAction = new TinyColor(colorAction); const baseColorAction = new TinyColor(colorIcon);
const baseColorActionHover = new TinyColor(colorActionHover); const baseColorActionHover = new TinyColor(colorIconHover);
const tableSelectedRowBg = controlItemBgActive; const tableSelectedRowBg = controlItemBgActive;
const zIndexTableFixed: number = 2; const zIndexTableFixed: number = 2;
@ -263,12 +263,12 @@ export default genComponentStyleHook('Table', token => {
tablePaddingHorizontalSmall: paddingXS, tablePaddingHorizontalSmall: paddingXS,
tableBorderColor: colorSplit, tableBorderColor: colorSplit,
tableHeaderTextColor: colorTextHeading, tableHeaderTextColor: colorTextHeading,
tableHeaderBg: colorBgContainerSecondary, tableHeaderBg: colorFillAlter,
tableFooterTextColor: colorTextHeading, tableFooterTextColor: colorTextHeading,
tableFooterBg: colorBgContainerSecondary, tableFooterBg: colorFillAlter,
tableHeaderCellSplitColor: colorSplit, tableHeaderCellSplitColor: colorSplit,
tableHeaderSortBg: colorBgContent, tableHeaderSortBg: colorFillSecondary,
tableHeaderSortHoverBg: colorBgFillTmp, tableHeaderSortHoverBg: colorFillContent,
tableHeaderIconColor: baseColorAction tableHeaderIconColor: baseColorAction
.clone() .clone()
.setAlpha(baseColorAction.getAlpha() * opacityLoading) .setAlpha(baseColorAction.getAlpha() * opacityLoading)
@ -277,11 +277,11 @@ export default genComponentStyleHook('Table', token => {
.clone() .clone()
.setAlpha(baseColorActionHover.getAlpha() * opacityLoading) .setAlpha(baseColorActionHover.getAlpha() * opacityLoading)
.toRgbString(), .toRgbString(),
tableBodySortBg: colorBgContainerSecondary, tableBodySortBg: colorFillAlter,
tableFixedHeaderSortActiveBg: colorBgContent, tableFixedHeaderSortActiveBg: colorFillSecondary,
tableHeaderFilterActiveBg: colorBgFillTmp, tableHeaderFilterActiveBg: colorFillContent,
tableFilterDropdownBg: colorBgContainer, tableFilterDropdownBg: colorBgContainer,
tableRowHoverBg: colorBgContainerSecondary, tableRowHoverBg: colorFillAlter,
tableSelectedRowBg, tableSelectedRowBg,
tableSelectedRowHoverBg: controlItemBgActiveHover, tableSelectedRowHoverBg: controlItemBgActiveHover,
zIndexTableFixed, zIndexTableFixed,
@ -291,7 +291,7 @@ export default genComponentStyleHook('Table', token => {
tableSelectionColumnWidth: controlHeight, tableSelectionColumnWidth: controlHeight,
tableExpandIconBg: colorBgContainer, tableExpandIconBg: colorBgContainer,
tableExpandColumnWidth: checkboxSize + 2 * token.padding, tableExpandColumnWidth: checkboxSize + 2 * token.padding,
tableExpandedRowBg: colorBgContainerSecondary, tableExpandedRowBg: colorFillAlter,
// Dropdown // Dropdown
tableFilterDropdownWidth: 120, tableFilterDropdownWidth: 120,

View File

@ -854,7 +854,7 @@ export default genComponentStyleHook(
tabsCardHeight, tabsCardHeight,
tabsCardGutter: token.marginXXS / 2, tabsCardGutter: token.marginXXS / 2,
tabsHorizontalGutter: token.marginXL, tabsHorizontalGutter: token.marginXL,
tabsCardHeadBackground: token.colorBgContainerSecondary, tabsCardHeadBackground: token.colorFillAlter,
dropdownEdgeChildVerticalPadding: token.paddingXXS, dropdownEdgeChildVerticalPadding: token.paddingXXS,
tabsActiveTextShadow: '0 0 0.25px currentcolor', tabsActiveTextShadow: '0 0 0.25px currentcolor',
tabsDropdownHeight: 200, tabsDropdownHeight: 200,

View File

@ -147,7 +147,7 @@ export default genComponentStyleHook('Tag', token => {
const tagFontSize = token.fontSizeSM; const tagFontSize = token.fontSizeSM;
const tagLineHeight = tagHeight - controlLineWidth * 2; const tagLineHeight = tagHeight - controlLineWidth * 2;
const tagDefaultBg = token.colorBgContainerSecondary; const tagDefaultBg = token.colorFillAlter;
const tagDefaultColor = token.colorText; const tagDefaultColor = token.colorText;
const tagToken = mergeToken<TagToken>(token, { const tagToken = mergeToken<TagToken>(token, {

View File

@ -204,16 +204,39 @@ export interface SeedToken extends PresetColorType {
opacityImage: number; opacityImage: number;
} }
export interface ColorMapToken { export interface TextMapToken {
colorText: string;
colorTextSecondary: string;
colorTextTertiary: string;
colorTextQuaternary: string;
}
export interface BgMapToken {
// 作为比较重的描边或者填充内容
colorFill: string;
// 表达 选中态,或者作为弱一级的实色 border
colorFillSecondary: string;
// 另外一种 hover 色 或者禁用的背景色
// 用于表达选中态或用于与区分 BgComponent 区分
colorFillTertiary: string;
colorFillQuaternary: string;
// Container 类型
colorBgContainer: string;
colorBgElevated: string;
colorBgLayout: string;
}
export interface ColorMapToken extends BgMapToken, TextMapToken {
// Color // Color
colorPrimary: string; colorPrimaryBg: string; // 1
colorPrimaryHover: string; colorPrimaryBgHover: string; // 2
colorPrimaryBg: string; colorPrimaryBorder: string; // 3
colorPrimaryBgHover: string; colorPrimaryBorderHover: string; // 4
colorPrimaryActive: string; colorPrimaryHover: string; // 5
colorPrimaryBorder: string; // primary[2] colorPrimary: string; // 6
colorPrimaryBorderHover: string; colorPrimaryActive: string; // 7
colorPrimaryOutline: string; colorPrimaryText: string; // 8
colorPrimaryTextHover: string; // 9
colorSuccess: string; colorSuccess: string;
colorSuccessBorder: string; colorSuccessBorder: string;
@ -224,63 +247,16 @@ export interface ColorMapToken {
colorWarningActive: string; colorWarningActive: string;
colorWarningBorder: string; colorWarningBorder: string;
colorWarningBg: string; colorWarningBg: string;
colorWarningOutline: string;
colorError: string; colorError: string;
colorErrorHover: string; colorErrorHover: string;
colorErrorActive: string; colorErrorActive: string;
colorErrorBorder: string; colorErrorBorder: string;
colorErrorBg: string; colorErrorBg: string;
colorErrorOutline: string;
colorInfo: string; colorInfo: string;
colorInfoBorder: string; colorInfoBorder: string;
colorInfoBg: string; colorInfoBg: string;
/** Color of layout background */
colorBgLayout: string;
colorBgContent: string;
/** Color of popup background */
colorBgElevated: string;
/** Color of component background */
colorBgContainer: string;
colorBgContentHover: string;
colorBgContainerSecondary: string;
colorBgContainerDisabled: string;
colorBorder: string;
colorBorderBg: string;
colorBorderSecondary: string;
colorSplit: string;
// Color
colorText: string;
colorTextSecondary: string;
colorTextDisabled: string;
colorTextHeading: string;
colorTextLabel: string;
/** Weak action. Such as `allowClear` or Alert close button */
colorAction: string;
/** Weak action hover color. Such as `allowClear` or Alert close button */
colorActionHover: string;
colorLink: string;
colorLinkHover: string;
colorLinkActive: string;
colorBgMask: string;
colorBgItemHover: string;
colorBgFillTmp: string;
colorBgTooltipTmp: string;
// FIXME: should be removed
buttonColorBgTextHover: string;
buttonColorBgTextActive: string;
segmentedBgColor: string;
segmentedBgColorHover: string;
segmentedBgColorActive: string;
} }
export interface CommonMapToken { export interface CommonMapToken {
@ -332,11 +308,43 @@ export interface MapToken extends SeedToken, ColorPalettes, ColorMapToken, Commo
// ====================================================================== // ======================================================================
// 🔥🔥🔥🔥🔥🔥🔥 DO NOT MODIFY THIS. PLEASE CONTACT DESIGNER. 🔥🔥🔥🔥🔥🔥🔥 // 🔥🔥🔥🔥🔥🔥🔥 DO NOT MODIFY THIS. PLEASE CONTACT DESIGNER. 🔥🔥🔥🔥🔥🔥🔥
export interface AliasToken extends MapToken { export interface AliasToken extends MapToken {
/** Placeholder text color */ // Background
colorFillSecondary: string;
colorFillContentHover: string;
colorFillAlter: string;
colorBgContainerDisabled: string;
colorBgMask: string;
colorBgSpotlight: string;
colorFillContent: string;
// Border
colorBorder: string;
colorBorderBg: string;
colorBorderSecondary: string;
colorSplit: string;
// Text
colorTextPlaceholder: string; colorTextPlaceholder: string;
colorTextDisabled: string;
colorTextHeading: string;
colorTextLabel: string;
/** Weak action. Such as `allowClear` or Alert close button */
colorIcon: string;
/** Weak action hover color. Such as `allowClear` or Alert close button */
colorIconHover: string;
colorLink: string;
colorLinkHover: string;
colorLinkActive: string;
colorHighlight: string; colorHighlight: string;
controlOutline: string;
colorWarningOutline: string;
colorErrorOutline: string;
// Font // Font
fontSizeSM: number; fontSizeSM: number;
fontSize: number; fontSize: number;

View File

@ -1,5 +1,6 @@
import type { BgMapToken, TextMapToken } from 'antd/es/theme/interface';
export interface PrimaryPalettes { export interface PrimaryPalettes {
0: string;
1: string; 1: string;
2: string; 2: string;
3: string; 3: string;
@ -7,6 +8,8 @@ export interface PrimaryPalettes {
5: string; 5: string;
6: string; 6: string;
7: string; 7: string;
8: string;
9: string;
} }
export interface SuccessPalettes { export interface SuccessPalettes {
@ -37,50 +40,10 @@ export interface InfoPalettes {
6: string; 6: string;
} }
export interface TextAlphaPalettes {
85: string;
65: string;
45: string;
30: string;
25: string;
// FIXME: 只有 Popover 用了
'light-75': string;
// 从 12 往下基本上就是偏背景和装饰性元素了
12: string;
// 另外一种 hover 色 或者禁用的背景色
8: string;
// 不透明度叠加色或文本色强化
4: string;
// 文本 hover 色
3: string;
}
export interface BgPalettes {
// 作为比较重的描边或者填充内容
26: string;
// 表达 选中态,或者作为弱一级的实色 border
19: string;
// 用于表达选中态或用于与区分 component 区分
15: string;
// 8 是卡片容器底色
8: string;
// Container 类型
// 12 是 elevated 模式
12: string;
// 0 是 base 模式
0: string;
// FIXME: 亮色需要额外增加的色彩序列
'light-12'?: string;
'light-2'?: string;
'light-10'?: string;
base: string;
}
export type GeneratePrimaryPalettes = (primaryBaseColor: string) => PrimaryPalettes; export type GeneratePrimaryPalettes = (primaryBaseColor: string) => PrimaryPalettes;
export type GenerateSuccessPalettes = (successBaseColor: string) => SuccessPalettes; export type GenerateSuccessPalettes = (successBaseColor: string) => SuccessPalettes;
export type GenerateWarningPalettes = (warningBaseColor: string) => WarningPalettes; export type GenerateWarningPalettes = (warningBaseColor: string) => WarningPalettes;
export type GenerateErrorPalettes = (errorBaseColor: string) => ErrorPalettes; export type GenerateErrorPalettes = (errorBaseColor: string) => ErrorPalettes;
export type GenerateInfoPalettes = (infoBaseColor: string) => InfoPalettes; export type GenerateInfoPalettes = (infoBaseColor: string) => InfoPalettes;
export type GenerateTextAlphaPalettes = (textBaseColor: string) => TextAlphaPalettes; export type GenerateTextAlphaPalettes = (textBaseColor: string) => TextMapToken;
export type GenerateBgPalettes = (bgBaseColor: string) => BgPalettes; export type GenerateBgPalettes = (bgBaseColor: string, textBaseColor: string) => BgMapToken;

View File

@ -1,19 +1,18 @@
import { generate } from '@ant-design/colors'; import { generate } from '@ant-design/colors';
import type { import type {
BgPalettes, GenerateBgPalettes,
ErrorPalettes, GenerateErrorPalettes,
InfoPalettes, GenerateInfoPalettes,
PrimaryPalettes, GeneratePrimaryPalettes,
SuccessPalettes, GenerateSuccessPalettes,
TextAlphaPalettes, GenerateTextAlphaPalettes,
WarningPalettes, GenerateWarningPalettes,
} from '../IPalettes'; } from '../IPalettes';
import { getAlphaColor, getSolidColor } from './colorAlgorithm'; import { getAlphaColor, getSolidColor } from './colorAlgorithm';
export function generatePrimaryPalettes(primaryBaseColor: string): PrimaryPalettes { export const generatePrimaryPalettes: GeneratePrimaryPalettes = (primaryBaseColor: string) => {
const primaryColors = generate(primaryBaseColor, { theme: 'dark' }); const primaryColors = generate(primaryBaseColor, { theme: 'dark' });
return { return {
0: '#0e161f',
1: primaryColors[0], 1: primaryColors[0],
2: primaryColors[1], 2: primaryColors[1],
3: primaryColors[2], 3: primaryColors[2],
@ -21,19 +20,21 @@ export function generatePrimaryPalettes(primaryBaseColor: string): PrimaryPalett
5: primaryColors[4], 5: primaryColors[4],
6: primaryColors[5], 6: primaryColors[5],
7: primaryColors[6], 7: primaryColors[6],
8: primaryColors[7],
9: primaryColors[8],
}; };
} };
export function generateSuccessPalettes(successBaseColor: string): SuccessPalettes { export const generateSuccessPalettes: GenerateSuccessPalettes = (successBaseColor: string) => {
const successColors = generate(successBaseColor, { theme: 'dark' }); const successColors = generate(successBaseColor, { theme: 'dark' });
return { return {
1: successColors[0], 1: successColors[0],
3: successColors[2], 3: successColors[2],
6: successColors[5], 6: successColors[5],
}; };
} };
export function generateErrorPalettes(errorBaseColor: string): ErrorPalettes { export const generateErrorPalettes: GenerateErrorPalettes = (errorBaseColor: string) => {
const errorColors = generate(errorBaseColor, { theme: 'dark' }); const errorColors = generate(errorBaseColor, { theme: 'dark' });
return { return {
1: errorColors[0], 1: errorColors[0],
@ -42,9 +43,9 @@ export function generateErrorPalettes(errorBaseColor: string): ErrorPalettes {
6: errorColors[5], 6: errorColors[5],
7: errorColors[6], 7: errorColors[6],
}; };
} };
export function generateWarningPalettes(warningBaseColor: string): WarningPalettes { export const generateWarningPalettes: GenerateWarningPalettes = (warningBaseColor: string) => {
const warningColors = generate(warningBaseColor, { theme: 'dark' }); const warningColors = generate(warningBaseColor, { theme: 'dark' });
return { return {
1: warningColors[0], 1: warningColors[0],
@ -53,44 +54,34 @@ export function generateWarningPalettes(warningBaseColor: string): WarningPalett
6: warningColors[5], 6: warningColors[5],
7: warningColors[6], 7: warningColors[6],
}; };
} };
export function generateInfoPalettes(infoBaseColor: string): InfoPalettes { export const generateInfoPalettes: GenerateInfoPalettes = (infoBaseColor: string) => {
const infoColors = generate(infoBaseColor, { theme: 'dark' }); const infoColors = generate(infoBaseColor, { theme: 'dark' });
return { return {
1: infoColors[0], 1: infoColors[0],
3: infoColors[2], 3: infoColors[2],
6: infoColors[5], 6: infoColors[5],
}; };
} };
export function generateBgPalettes(bgBaseColor: string): BgPalettes { export const generateBgPalettes: GenerateBgPalettes = (
return { bgBaseColor: string,
'light-2': getSolidColor(bgBaseColor, 2), textBaseColor: string,
'light-10': getSolidColor(bgBaseColor, 10), ) => ({
'light-12': getSolidColor(bgBaseColor, 12), colorFill: getAlphaColor(textBaseColor, 18),
26: getSolidColor(bgBaseColor, 26), colorFillSecondary: getAlphaColor(textBaseColor, 12),
19: getSolidColor(bgBaseColor, 19), colorFillTertiary: getAlphaColor(textBaseColor, 8),
15: getSolidColor(bgBaseColor, 15), colorFillQuaternary: getAlphaColor(textBaseColor, 4),
12: getSolidColor(bgBaseColor, 12),
8: getSolidColor(bgBaseColor, 8),
0: getSolidColor(bgBaseColor, 0),
base: getSolidColor(bgBaseColor, 0),
};
}
export function generateTextAlphaPalettes(textBaseColor: string): TextAlphaPalettes { colorBgElevated: getSolidColor(bgBaseColor, 12),
return { colorBgContainer: getSolidColor(bgBaseColor, 8),
85: getAlphaColor(textBaseColor, 0.85), colorBgLayout: getSolidColor(bgBaseColor, 0),
'light-75': getAlphaColor(textBaseColor, 0.75), });
65: getAlphaColor(textBaseColor, 0.65), // 目前只有 Segment Label 用了
45: getAlphaColor(textBaseColor, 0.45), export const generateTextAlphaPalettes: GenerateTextAlphaPalettes = (textBaseColor: string) => ({
30: getAlphaColor(textBaseColor, 0.3), colorText: getAlphaColor(textBaseColor, 0.85),
25: getAlphaColor(textBaseColor, 0.25), colorTextSecondary: getAlphaColor(textBaseColor, 0.65),
// 从 12 往下基本上就是偏背景和装饰性元素了 colorTextTertiary: getAlphaColor(textBaseColor, 0.45),
12: getAlphaColor(textBaseColor, 0.12), colorTextQuaternary: getAlphaColor(textBaseColor, 0.25),
8: getAlphaColor(textBaseColor, 0.08), });
4: getAlphaColor(textBaseColor, 0.04),
3: getAlphaColor(textBaseColor, 0.03),
};
}

View File

@ -13,7 +13,6 @@ import { getAlphaColor, getSolidColor } from './colorAlgorithm';
export const generatePrimaryPalettes: GeneratePrimaryPalettes = (primaryBaseColor: string) => { export const generatePrimaryPalettes: GeneratePrimaryPalettes = (primaryBaseColor: string) => {
const primaryColors = generate(primaryBaseColor); const primaryColors = generate(primaryBaseColor);
return { return {
0: primaryBaseColor,
1: primaryColors[0], 1: primaryColors[0],
2: primaryColors[1], 2: primaryColors[1],
3: primaryColors[2], 3: primaryColors[2],
@ -21,6 +20,8 @@ export const generatePrimaryPalettes: GeneratePrimaryPalettes = (primaryBaseColo
5: primaryColors[4], 5: primaryColors[4],
6: primaryColors[5], 6: primaryColors[5],
7: primaryColors[6], 7: primaryColors[6],
8: primaryColors[7],
9: primaryColors[8],
}; };
}; };
@ -64,29 +65,23 @@ export const generateInfoPalettes: GenerateInfoPalettes = (infoBaseColor: string
}; };
}; };
export const generateBgPalettes: GenerateBgPalettes = (bgBaseColor: string) => ({ export const generateBgPalettes: GenerateBgPalettes = (
26: getSolidColor(bgBaseColor, 15), bgBaseColor: string,
'light-2': getSolidColor(bgBaseColor, 2), textBaseColor: string,
'light-10': getSolidColor(bgBaseColor, 10), ) => ({
'light-12': getSolidColor(bgBaseColor, 12), colorFill: getAlphaColor(textBaseColor, 0.06),
19: getSolidColor(bgBaseColor, 6), colorFillSecondary: getAlphaColor(textBaseColor, 0.04),
15: getSolidColor(bgBaseColor, 4), colorFillTertiary: getAlphaColor(textBaseColor, 0.03),
12: getSolidColor(bgBaseColor, 0), colorFillQuaternary: getAlphaColor(textBaseColor, 0.02),
8: getSolidColor(bgBaseColor, 0),
0: getSolidColor(bgBaseColor, 4), colorBgLayout: getSolidColor(bgBaseColor, 4),
base: getSolidColor(bgBaseColor, 0), colorBgContainer: getSolidColor(bgBaseColor, 0),
colorBgElevated: getSolidColor(bgBaseColor, 0),
}); });
export const generateTextAlphaPalettes: GenerateTextAlphaPalettes = (textBaseColor: string) => ({ export const generateTextAlphaPalettes: GenerateTextAlphaPalettes = (textBaseColor: string) => ({
85: getAlphaColor(textBaseColor, 0.85), colorText: getAlphaColor(textBaseColor, 0.85),
'light-75': getAlphaColor(textBaseColor, 0.75), // 目前只有 Popover 用了 colorTextSecondary: getAlphaColor(textBaseColor, 0.65), // 目前只有 Segment Label 用了
65: getAlphaColor(textBaseColor, 0.65), // 目前只有 Segment Label 用了 colorTextTertiary: getAlphaColor(textBaseColor, 0.45),
45: getAlphaColor(textBaseColor, 0.45), colorTextQuaternary: getAlphaColor(textBaseColor, 0.25),
30: getAlphaColor(textBaseColor, 0.25),
25: getAlphaColor(textBaseColor, 0.25),
// 从 12 往下基本上就是偏背景和装饰性元素了
12: getAlphaColor(textBaseColor, 0.06), // 主要是 Split
8: getAlphaColor(textBaseColor, 0.04),
4: getAlphaColor(textBaseColor, 0.03),
3: getAlphaColor(textBaseColor, 0.02),
}); });

View File

@ -1,4 +1,3 @@
import { TinyColor } from '@ctrl/tinycolor';
import type { ColorMapToken, SeedToken } from '../../interface'; import type { ColorMapToken, SeedToken } from '../../interface';
import type { import type {
GenerateBgPalettes, GenerateBgPalettes,
@ -47,86 +46,41 @@ export default function genColorMapToken(
const warningColors = generateWarningPalettes(colorWarningBase); const warningColors = generateWarningPalettes(colorWarningBase);
const errorColors = generateErrorPalettes(colorErrorBase); const errorColors = generateErrorPalettes(colorErrorBase);
const infoColors = generateInfoPalettes(colorInfoBase); const infoColors = generateInfoPalettes(colorInfoBase);
const bgColors = generateBgPalettes(colorBgBase); const bgColors = generateBgPalettes(colorBgBase, colorTextBase);
const textColors = generateTextAlphaPalettes(colorTextBase); const textColors = generateTextAlphaPalettes(colorTextBase);
const colorPrimary = primaryColors['6'];
const colorError = errorColors['5'];
const colorWarning = warningColors['6'];
const colorSuccess = successColors['6'];
const colorInfo = infoColors['6'];
return { return {
colorPrimary, ...bgColors,
colorPrimaryHover: primaryColors['5'], ...textColors,
colorPrimaryBg: primaryColors['1'],
colorPrimaryBgHover: primaryColors['0'],
colorPrimaryActive: primaryColors['7'],
colorPrimaryBorder: primaryColors['3'],
colorPrimaryBorderHover: primaryColors['4'],
colorPrimaryOutline: new TinyColor(colorPrimary).setAlpha(0.2).toRgbString(),
colorSuccess, colorPrimaryBg: primaryColors[1],
colorSuccessBg: successColors['1'], colorPrimaryBgHover: primaryColors[2],
colorSuccessBorder: successColors['3'], colorPrimaryBorder: primaryColors[3],
colorPrimaryBorderHover: primaryColors[4],
colorPrimaryHover: primaryColors[5],
colorPrimary: primaryColors[6],
colorPrimaryActive: primaryColors[7],
colorPrimaryText: primaryColors[8],
colorPrimaryTextHover: primaryColors[9],
colorError, colorSuccessBg: successColors[1],
colorErrorBg: errorColors['1'], colorSuccessBorder: successColors[3],
colorErrorBorder: errorColors['3'], colorSuccess: successColors[6],
colorErrorHover: errorColors['5'],
colorErrorActive: errorColors['7'],
colorErrorOutline: new TinyColor(colorError).setAlpha(0.2).toRgbString(),
colorWarning, colorErrorBg: errorColors[1],
colorWarningBg: warningColors['1'], colorErrorBorder: errorColors[3],
colorWarningBorder: warningColors['3'], colorErrorHover: errorColors[5],
colorWarningHover: warningColors['5'], colorError: errorColors[6],
colorWarningActive: warningColors['7'], colorErrorActive: errorColors[7],
colorWarningOutline: new TinyColor(colorWarning).setAlpha(0.2).toRgbString(),
colorInfo, colorWarningBg: warningColors[1],
colorInfoBg: infoColors['1'], colorWarningBorder: warningColors[3],
colorInfoBorder: infoColors['3'], colorWarningHover: warningColors[5],
colorWarning: warningColors[6],
colorWarningActive: warningColors[7],
colorLink: primaryColors['6'], colorInfoBg: infoColors[1],
colorLinkHover: primaryColors['5'], colorInfoBorder: infoColors[3],
colorLinkActive: primaryColors['7'], colorInfo: infoColors[6],
// ============== Background ============== //
colorBgLayout: bgColors['0'],
colorBgElevated: bgColors['12'],
colorBgContainer: bgColors['8'],
colorBgContent: bgColors['15'],
colorBgContentHover: bgColors['26'],
colorBgContainerSecondary: textColors['4'],
colorBgContainerDisabled: textColors['8'],
colorBgMask: textColors['45'],
colorBgItemHover: textColors['8'],
colorBgFillTmp: textColors['12'],
colorBgTooltipTmp: textColors['85'],
// ============== Split ============== //
colorBorder: bgColors['26'],
colorBorderSecondary: bgColors['19'],
colorBorderBg: bgColors.base,
colorSplit: textColors['12'],
// ============== Text ============== //
colorText: textColors['85'],
colorTextHeading: textColors['85'],
colorTextSecondary: textColors['45'],
colorTextDisabled: textColors['25'],
colorTextLabel: textColors['65'],
colorAction: textColors['45'],
colorActionHover: textColors['85'],
buttonColorBgTextHover: textColors['3'],
buttonColorBgTextActive: textColors['4'],
segmentedBgColor: textColors['8'],
segmentedBgColorHover: textColors['12'],
segmentedBgColorActive: bgColors['8'],
}; };
} }

View File

@ -31,9 +31,38 @@ export default function formatToken(derivativeToken: RawMergedToken): AliasToken
const aliasToken: AliasToken = { const aliasToken: AliasToken = {
...mergedToken, ...mergedToken,
colorTextPlaceholder: mergedToken.colorTextDisabled, colorLink: mergedToken.colorPrimary,
colorLinkHover: mergedToken.colorPrimaryHover,
colorLinkActive: mergedToken.colorPrimaryActive,
// ============== Background ============== //
colorFillContent: mergedToken.colorFillSecondary,
colorFillContentHover: mergedToken.colorFill,
colorFillAlter: mergedToken.colorFillQuaternary,
colorBgContainerDisabled: mergedToken.colorFillTertiary,
colorBgMask: mergedToken.colorTextTertiary,
colorBgSpotlight: mergedToken.colorText,
// ============== Split ============== //
colorBorderBg: mergedToken.colorBgLayout,
colorBorder: mergedToken.colorFill,
colorBorderSecondary: mergedToken.colorFillSecondary,
colorSplit: mergedToken.colorFillSecondary,
// ============== Text ============== //
colorTextPlaceholder: mergedToken.colorTextQuaternary,
colorTextDisabled: mergedToken.colorTextQuaternary,
colorTextHeading: mergedToken.colorText,
colorTextLabel: mergedToken.colorTextSecondary,
colorHighlight: mergedToken.colorError, colorHighlight: mergedToken.colorError,
colorIcon: mergedToken.colorTextTertiary,
colorIconHover: mergedToken.colorText,
colorErrorOutline: mergedToken.colorErrorBg,
colorWarningOutline: mergedToken.colorWarningBg,
// Font // Font
fontSizeSM, fontSizeSM,
fontSize: fontSizes[1], fontSize: fontSizes[1],
@ -62,13 +91,16 @@ export default function formatToken(derivativeToken: RawMergedToken): AliasToken
// Checkbox size and expand icon size // Checkbox size and expand icon size
controlInteractiveSize: mergedToken.controlHeight / 2, controlInteractiveSize: mergedToken.controlHeight / 2,
controlItemBgHover: mergedToken.colorBgItemHover, controlItemBgHover: mergedToken.colorFillTertiary,
controlItemBgActive: mergedToken.colorPrimaryBg, controlItemBgActive: mergedToken.colorPrimaryBg,
controlItemBgActiveHover: mergedToken.colorPrimaryBgHover, controlItemBgActiveHover: mergedToken.colorPrimaryBgHover,
controlItemBgActiveDisabled: mergedToken.colorTextDisabled, controlItemBgActiveDisabled: mergedToken.colorTextQuaternary,
controlTmpOutline: mergedToken.colorFillQuaternary,
controlOutline: mergedToken.colorPrimaryBg,
controlLineType: mergedToken.lineType, controlLineType: mergedToken.lineType,
controlRadius: mergedToken.radiusBase, controlRadius: mergedToken.radiusBase,
fontWeightStrong: 600, fontWeightStrong: 600,
opacityLoading: 0.65, opacityLoading: 0.65,
@ -121,8 +153,6 @@ export default function formatToken(derivativeToken: RawMergedToken): AliasToken
screenXXLMin: screenXXL, screenXXLMin: screenXXL,
screenXXLMax: screenXXL - 1, screenXXLMax: screenXXL - 1,
controlTmpOutline: mergedToken.colorBgContainerSecondary,
// FIXME: component box-shadow, should be removed // FIXME: component box-shadow, should be removed
boxShadowPopoverArrow: `3px 3px 7px rgba(0, 0, 0, 0.1)`, boxShadowPopoverArrow: `3px 3px 7px rgba(0, 0, 0, 0.1)`,
boxShadowPopoverArrowBottom: `2px 2px 5px rgba(0, 0, 0, 0.1)`, boxShadowPopoverArrowBottom: `2px 2px 5px rgba(0, 0, 0, 0.1)`,

View File

@ -135,9 +135,9 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
return [genTooltipStyle(TooltipToken), initZoomMotion(token, 'zoom-big-fast')]; return [genTooltipStyle(TooltipToken), initZoomMotion(token, 'zoom-big-fast')];
}, },
({ zIndexPopupBase, colorBgTooltipTmp }) => ({ ({ zIndexPopupBase, colorBgSpotlight }) => ({
zIndexPopup: zIndexPopupBase + 70, zIndexPopup: zIndexPopupBase + 70,
colorBgDefault: colorBgTooltipTmp, colorBgDefault: colorBgSpotlight,
}), }),
); );

View File

@ -89,7 +89,7 @@ export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject =>
}, },
'&-focused:not(:hover):not(&-active-focused)': { '&-focused:not(:hover):not(&-active-focused)': {
background: token.colorPrimaryOutline, background: token.controlOutline,
}, },
// =================== Virtual List =================== // =================== Virtual List ===================
@ -282,7 +282,7 @@ export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject =>
}, },
[`&${treeCls}-node-selected`]: { [`&${treeCls}-node-selected`]: {
backgroundColor: token.colorPrimaryOutline, backgroundColor: token.controlOutline,
}, },
// Icon // Icon

View File

@ -11,7 +11,7 @@ const genDraggerStyle: GenerateStyle<UploadToken> = token => {
width: '100%', width: '100%',
height: '100%', height: '100%',
textAlign: 'center', textAlign: 'center',
background: token.colorBgContainerSecondary, background: token.colorFillAlter,
border: `${token.controlLineWidth}px dashed ${token.colorBorder}`, border: `${token.controlLineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.radiusBase, borderRadius: token.radiusBase,
cursor: 'pointer', cursor: 'pointer',

View File

@ -99,7 +99,7 @@ const genPictureCardStyle: GenerateStyle<UploadToken> = token => {
marginBottom: token.marginXS, marginBottom: token.marginXS,
textAlign: 'center', textAlign: 'center',
verticalAlign: 'top', verticalAlign: 'top',
backgroundColor: token.colorBgContainerSecondary, backgroundColor: token.colorFillAlter,
border: `${token.controlLineWidth}px dashed ${token.colorBorder}`, border: `${token.controlLineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.radiusBase, borderRadius: token.radiusBase,
cursor: 'pointer', cursor: 'pointer',
@ -206,7 +206,7 @@ const genPictureCardStyle: GenerateStyle<UploadToken> = token => {
[`${itemCls}-uploading`]: { [`${itemCls}-uploading`]: {
[`&${itemCls}`]: { [`&${itemCls}`]: {
backgroundColor: token.colorBgContainerSecondary, backgroundColor: token.colorFillAlter,
}, },
[`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: { [`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {