UNPKG

@wordpress/block-library

Version:
28 lines (22 loc) 919 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.detectColors = detectColors; function getComputedStyle(node) { return node.ownerDocument.defaultView.getComputedStyle(node); } function detectColors(colorsDetectionElement, setColor, setBackground) { if (!colorsDetectionElement) { return; } setColor(getComputedStyle(colorsDetectionElement).color); let backgroundColorNode = colorsDetectionElement; let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { backgroundColorNode = backgroundColorNode.parentNode; backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; } setBackground(backgroundColor); } //# sourceMappingURL=utils.js.map