Sha256: d7e20d7f4215f1ed5eb61c0ff57dd4b9a264f6bf50ed1065c303585ed70f9c81
Contents?: true
Size: 942 Bytes
Versions: 104
Compression:
Stored size: 942 Bytes
Contents
/* global axe, color */ /** * Returns the flattened foreground color of an element, or null if it can't be determined because * of transparency * @method getForegroundColor * @memberof axe.commons.color * @instance * @param {Element} node * @param {Boolean} noScroll (default false) * @return {Color|null} */ color.getForegroundColor = function(node, noScroll) { var nodeStyle = window.getComputedStyle(node); var fgColor = new color.Color(); fgColor.parseRgbString(nodeStyle.getPropertyValue('color')); var opacity = nodeStyle.getPropertyValue('opacity'); fgColor.alpha = fgColor.alpha * opacity; if (fgColor.alpha === 1) { return fgColor; } var bgColor = color.getBackgroundColor(node, [], noScroll); if (bgColor === null) { var reason = axe.commons.color.incompleteData.get('bgColor'); axe.commons.color.incompleteData.set('fgColor', reason); return null; } return color.flattenColors(fgColor, bgColor); };
Version data entries
104 entries across 104 versions & 1 rubygems