mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-19 20:08:43 +08:00
26 lines
686 B
TypeScript
26 lines
686 B
TypeScript
|
export function isValidWaveColor(color: string) {
|
||
|
return (
|
||
|
color &&
|
||
|
color !== '#fff' &&
|
||
|
color !== '#ffffff' &&
|
||
|
color !== 'rgb(255, 255, 255)' &&
|
||
|
color !== 'rgba(255, 255, 255, 1)' &&
|
||
|
!/rgba\((?:\d*, ){3}0\)/.test(color) && // any transparent rgba color
|
||
|
color !== 'transparent'
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export function getTargetWaveColor(node: HTMLElement) {
|
||
|
const { borderTopColor, borderColor, backgroundColor } = getComputedStyle(node);
|
||
|
if (isValidWaveColor(borderTopColor)) {
|
||
|
return borderTopColor;
|
||
|
}
|
||
|
if (isValidWaveColor(borderColor)) {
|
||
|
return borderColor;
|
||
|
}
|
||
|
if (isValidWaveColor(backgroundColor)) {
|
||
|
return backgroundColor;
|
||
|
}
|
||
|
return null;
|
||
|
}
|