@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
70 lines • 3.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTheme = exports.getCustomTheme = void 0;
const tslib_1 = require("tslib");
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
const ThemeColor_1 = require("../themes/ThemeColor");
const base_theme_1 = require("../themes/base-theme");
const blue_theme_1 = require("../themes/colors/blue-theme");
const teal_theme_1 = require("../themes/colors/teal-theme");
const yellow_theme_1 = require("../themes/colors/yellow-theme");
const gray_theme_1 = require("../themes/colors/gray-theme");
const green_theme_1 = require("../themes/colors/green-theme");
const skeleton_theme_1 = require("../themes/colors/skeleton-theme");
const multi_ordered_theme_1 = require("../themes/colors/multi-ordered-theme");
const multi_unordered_theme_1 = require("../themes/colors/multi-unordered-theme");
const orange_theme_1 = require("../themes/colors/orange-theme");
const purple_theme_1 = require("../themes/colors/purple-theme");
/**
* Apply custom properties to base and color themes
*
* @param themeColor The theme color to merge with custom theme
* @param customTheme The custom theme to merge
* @public
* @beta
*/
const getCustomTheme = (themeColor, customTheme) => (0, merge_1.default)((0, exports.getTheme)(themeColor), customTheme);
exports.getCustomTheme = getCustomTheme;
/**
* Returns base theme for given color
* @public
* @beta
*/
const getTheme = (themeColor) => {
const baseTheme = (0, cloneDeep_1.default)((0, base_theme_1.BaseTheme)());
return (0, merge_1.default)(baseTheme, getThemeColors(themeColor));
};
exports.getTheme = getTheme;
/**
* Returns computed theme colors
* @private Not intended as public API and subject to change
*/
const getThemeColors = (themeColor) => {
switch (themeColor) {
case ThemeColor_1.ThemeColor.blue:
return (0, blue_theme_1.getBlueColorTheme)();
case ThemeColor_1.ThemeColor.teal:
return (0, teal_theme_1.getTealColorTheme)();
case ThemeColor_1.ThemeColor.yellow:
return (0, yellow_theme_1.getYellowColorTheme)();
case ThemeColor_1.ThemeColor.gray:
return (0, gray_theme_1.getGrayColorTheme)();
case ThemeColor_1.ThemeColor.green:
return (0, green_theme_1.getGreenColorTheme)();
case ThemeColor_1.ThemeColor.multi:
case ThemeColor_1.ThemeColor.multiOrdered:
return (0, multi_ordered_theme_1.getMultiColorOrderedTheme)();
case ThemeColor_1.ThemeColor.multiUnordered:
return (0, multi_unordered_theme_1.getMultiColorUnorderedTheme)();
case ThemeColor_1.ThemeColor.orange:
return (0, orange_theme_1.getOrangeColorTheme)();
case ThemeColor_1.ThemeColor.purple:
return (0, purple_theme_1.getPurpleColorTheme)();
case ThemeColor_1.ThemeColor.skeleton:
return (0, skeleton_theme_1.getSkeletonColorTheme)();
default:
return (0, blue_theme_1.getBlueColorTheme)();
}
};
//# sourceMappingURL=theme.js.map