recharts
Version:
React charts
27 lines (26 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getEffectivePageBackground = getEffectivePageBackground;
/**
* Returns the color that Recharts uses to draw gaps and halos that look like cut-outs.
*
* An explicit `pageBackground` always wins.
* Otherwise, if the theme paints `chart.backgroundColor`, that color is what sits behind the chart, so it is used instead.
* `pageBackground` never paints `chart.backgroundColor`: Recharts only paints a background when asked to.
*
* @param theme the active theme
* @returns the effective page background, or undefined if the theme sets neither
*/
function getEffectivePageBackground(theme) {
var _theme$chart;
if (theme == null) {
return undefined;
}
if (theme.pageBackground != null) {
return theme.pageBackground;
}
var chartBackgroundColor = (_theme$chart = theme.chart) === null || _theme$chart === void 0 ? void 0 : _theme$chart.backgroundColor;
return typeof chartBackgroundColor === 'string' ? chartBackgroundColor : undefined;
}