mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
502dac12aa
* docs: fix code * feat: lint * feat: prettier * feat: test * feat: review * feat: format html * feat: format html
26 lines
685 B
TypeScript
26 lines
685 B
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
|
|
import type * as React from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
import { isPresetColor } from '../_util/colors';
|
|
|
|
export function parseColor(prefixCls: string, color?: string) {
|
|
const isInternalColor = isPresetColor(color);
|
|
|
|
const className = classNames({
|
|
[`${prefixCls}-${color}`]: color && isInternalColor,
|
|
});
|
|
|
|
const overlayStyle: React.CSSProperties = {};
|
|
const arrowStyle: React.CSSProperties = {};
|
|
|
|
if (color && !isInternalColor) {
|
|
overlayStyle.background = color;
|
|
// @ts-ignore
|
|
arrowStyle['--antd-arrow-background-color'] = color;
|
|
}
|
|
|
|
return { className, overlayStyle, arrowStyle };
|
|
}
|