@braineet/ui
Version:
Braineet design system
19 lines • 964 B
JavaScript
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import get from 'lodash/get';
import isObject from 'lodash/isObject';
import merge from 'lodash/merge';
/**
* Util function for theming.
* @param {object} object - an object with theme presets.
* @param {*} keyOrValue - the key for the object, or an actual value.
* @return {*} the value of the object, or the `keyOrValue` itself.
*/
var themedProperty = function themedProperty(object, keyOrValue) {
if (object && isObject(object)) {
return get(object, keyOrValue, keyOrValue);
}
return keyOrValue;
};
export default (function (color, colors) {
return themedProperty(merge(colors, _extends({}, colors.dark, colors.primary, colors.secondary, colors.intent)), color);
});