mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
fix: adjust onBackground outputs to support semi-transparent colors (#40729)
* chore(deps): bump @ctrl/tinycolor from 3.4.0 to 3.6.0 * fix: adjust onBackground outputs to support semi-transparent colors
This commit is contained in:
parent
f8c511045d
commit
76dc87f1c3
@ -1,6 +1,6 @@
|
||||
import { TinyColor } from '@ctrl/tinycolor';
|
||||
import * as React from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { TinyColor } from '@ctrl/tinycolor';
|
||||
import { useToken } from '../theme/internal';
|
||||
|
||||
const Simple = () => {
|
||||
@ -10,9 +10,13 @@ const Simple = () => {
|
||||
|
||||
const { borderColor, shadowColor, contentColor } = useMemo(
|
||||
() => ({
|
||||
borderColor: new TinyColor(colorFill).onBackground(colorBgContainer).toHexString(),
|
||||
shadowColor: new TinyColor(colorFillTertiary).onBackground(colorBgContainer).toHexString(),
|
||||
contentColor: new TinyColor(colorFillQuaternary).onBackground(colorBgContainer).toHexString(),
|
||||
borderColor: new TinyColor(colorFill).onBackground(colorBgContainer).toHexShortString(),
|
||||
shadowColor: new TinyColor(colorFillTertiary)
|
||||
.onBackground(colorBgContainer)
|
||||
.toHexShortString(),
|
||||
contentColor: new TinyColor(colorFillQuaternary)
|
||||
.onBackground(colorBgContainer)
|
||||
.toHexShortString(),
|
||||
}),
|
||||
[colorFill, colorFillTertiary, colorFillQuaternary, colorBgContainer],
|
||||
);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { CSSObject } from '@ant-design/cssinjs';
|
||||
import type * as React from 'react';
|
||||
import { TinyColor } from '@ctrl/tinycolor';
|
||||
import type * as React from 'react';
|
||||
import { resetComponent } from '../../style';
|
||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||
import { resetComponent } from '../../style';
|
||||
|
||||
// Direction naming standard:
|
||||
// Horizontal base:
|
||||
@ -214,7 +214,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = (token) => {
|
||||
height: token.handleSize,
|
||||
boxShadow: `0 0 0 ${token.handleLineWidth}px ${new TinyColor(token.colorTextDisabled)
|
||||
.onBackground(token.colorBgContainer)
|
||||
.toHexString()}`,
|
||||
.toHexShortString()}`,
|
||||
insetInlineStart: 0,
|
||||
insetBlockStart: 0,
|
||||
},
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { CSSObject } from '@ant-design/cssinjs';
|
||||
import { TinyColor } from '@ctrl/tinycolor';
|
||||
import { clearFix, resetComponent } from '../../style';
|
||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||
import genBorderedStyle from './bordered';
|
||||
@ -16,7 +17,6 @@ import genSizeStyle from './size';
|
||||
import genSorterStyle from './sorter';
|
||||
import genStickyStyle from './sticky';
|
||||
import genSummaryStyle from './summary';
|
||||
import { clearFix, resetComponent } from '../../style';
|
||||
|
||||
export interface ComponentToken {}
|
||||
|
||||
@ -257,14 +257,14 @@ export default genComponentStyleHook('Table', (token) => {
|
||||
|
||||
const colorFillSecondarySolid = new TinyColor(colorFillSecondary)
|
||||
.onBackground(colorBgContainer)
|
||||
.toHexString();
|
||||
.toHexShortString();
|
||||
const colorFillContentSolid = new TinyColor(colorFillContent)
|
||||
.onBackground(colorBgContainer)
|
||||
.toHexString();
|
||||
.toHexShortString();
|
||||
|
||||
const colorFillAlterSolid = new TinyColor(colorFillAlter)
|
||||
.onBackground(colorBgContainer)
|
||||
.toHexString();
|
||||
.toHexShortString();
|
||||
|
||||
const tableToken = mergeToken<TableToken>(token, {
|
||||
tableFontSize: fontSize,
|
||||
|
@ -112,7 +112,7 @@
|
||||
"@ant-design/icons": "^5.0.0",
|
||||
"@ant-design/react-slick": "~1.0.0",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@ctrl/tinycolor": "^3.4.0",
|
||||
"@ctrl/tinycolor": "^3.6.0",
|
||||
"@rc-component/mutate-observer": "^1.0.0",
|
||||
"@rc-component/tour": "~1.6.0",
|
||||
"classnames": "^2.2.6",
|
||||
|
Loading…
Reference in New Issue
Block a user