Browse Source

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
pull/40802/head
Jungzl 2 years ago
committed by GitHub
parent
commit
76dc87f1c3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      components/empty/simple.tsx
  2. 6
      components/slider/style/index.tsx
  3. 8
      components/table/style/index.ts
  4. 2
      package.json

12
components/empty/simple.tsx

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

6
components/slider/style/index.tsx

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

8
components/table/style/index.ts

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

2
package.json

@ -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…
Cancel
Save