| 1234567891011121314151617181920212223242526272829303132333435363738 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getTargetWaveColor = getTargetWaveColor;
- exports.isNotGrey = isNotGrey;
- exports.isValidWaveColor = isValidWaveColor;
- function isNotGrey(color) {
- // eslint-disable-next-line no-useless-escape
- const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);
- if (match && match[1] && match[2] && match[3]) {
- return !(match[1] === match[2] && match[2] === match[3]);
- }
- return true;
- }
- function isValidWaveColor(color) {
- return color && color !== '#fff' && color !== '#ffffff' && color !== 'rgb(255, 255, 255)' && color !== 'rgba(255, 255, 255, 1)' && isNotGrey(color) && !/rgba\((?:\d*, ){3}0\)/.test(color) &&
- // any transparent rgba color
- color !== 'transparent';
- }
- function getTargetWaveColor(node) {
- const {
- borderTopColor,
- borderColor,
- backgroundColor
- } = getComputedStyle(node);
- if (isValidWaveColor(borderTopColor)) {
- return borderTopColor;
- }
- if (isValidWaveColor(borderColor)) {
- return borderColor;
- }
- if (isValidWaveColor(backgroundColor)) {
- return backgroundColor;
- }
- return null;
- }
|