Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_needsLightText(bgColor) {
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
if (!color) {
return false;
}
return isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]));
}
_needsLightText(bgColor) {
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
if (!color) {
return false;
}
return isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]));
}
}}
className="gphNode"
>
_needsLightText(bgColor) {
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
if (!color) {
return false;
}
return isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]));
}
labelColor = d => {
const bgColor = z(d);
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
return color && isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]))
? '#FFF' : '#222';
};
}
<div>
{text && (
<span>
{text}
</span>
)}
</div>
);
}
const rgb = hexToRgb(backgroundColor);
let color = 'text';
if (rgb && isColorDark(rgb[0], rgb[1], rgb[2])) {
color = 'ghost';
}
return (
<div>
{text && (
<span>
{text}
</span>
)}
</div>
);
};
labelColor = d => {
const bgColor = z(d);
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
return color && isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]))
? '#FFF' : '#222';
};
}