UNPKG

@braineet/ui

Version:

Braineet design system

19 lines 1.03 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, 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); });