import { lighten as lightenPolished, darken as darkenPolished, complement as complementPolished, rgba as rgbaPolished, } from 'polished' import * as _ from 'lodash' /** * Builds a polishedHelper which can be composed in template string literal with our get functions like that * ${lighten(0.1, colorGet("some getter"))} */ const buildStyledComposableHelper = polishedHelper => ( // Default values here are so function is not fail and drills through to the polished fn to get meaningful error message value = '', somethingGet = _.noop, ) => props => polishedHelper(value, somethingGet(props)) export const lighten = buildStyledComposableHelper(lightenPolished) export const darken = buildStyledComposableHelper(darkenPolished) export const complement = fn => props => complementPolished(fn(props)) export const rgba = (fn, value) => props => rgbaPolished(fn(props), value)