MCPcopy Index your code
hub / github.com/bqplot/bqplot / getEffectiveBackgroundColor

Function getEffectiveBackgroundColor

js/src/utils.ts:128–146  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

126}
127
128export function getEffectiveBackgroundColor(element) {
129 if (!element) {
130 // If no element provided or we have traversed beyond the body or html,
131 // we default to white as the background color.
132 return 'rgb(255, 255, 255)';
133 }
134
135 const style = window.getComputedStyle(element);
136 const bgColor = style.backgroundColor;
137 const hasBackgroundImage = style.backgroundImage !== 'none';
138 const isTransparent =
139 bgColor === 'transparent' || bgColor === 'rgba(0, 0, 0, 0)';
140
141 if (!isTransparent || hasBackgroundImage) {
142 return bgColor;
143 }
144
145 return getEffectiveBackgroundColor(element.parentElement);
146}

Callers 1

get_svgMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…