first commit
This commit is contained in:
25
frontend/node_modules/antd/es/tooltip/util.js
generated
vendored
Normal file
25
frontend/node_modules/antd/es/tooltip/util.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import classNames from 'classnames';
|
||||
import { isPresetColor } from '../_util/colors';
|
||||
import { generateColor } from '../color-picker/util';
|
||||
export function parseColor(prefixCls, color) {
|
||||
const isInternalColor = isPresetColor(color);
|
||||
const className = classNames({
|
||||
[`${prefixCls}-${color}`]: color && isInternalColor
|
||||
});
|
||||
const overlayStyle = {};
|
||||
const arrowStyle = {};
|
||||
const rgb = generateColor(color).toRgb();
|
||||
const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255;
|
||||
const textColor = luminance < 0.5 ? '#FFF' : '#000';
|
||||
if (color && !isInternalColor) {
|
||||
overlayStyle.background = color;
|
||||
overlayStyle['--ant-tooltip-color'] = textColor;
|
||||
// @ts-ignore
|
||||
arrowStyle['--antd-arrow-background-color'] = color;
|
||||
}
|
||||
return {
|
||||
className,
|
||||
overlayStyle,
|
||||
arrowStyle
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user