Support colors not in map

If you specify a background color that isn't a key in the colors map,
we just assume it's an actual color value and let you use it.
This commit is contained in:
Adam Wathan 2017-08-25 10:00:21 -04:00
parent 8e7b2dc1fa
commit c84f0ec4b7

View file

@ -2,9 +2,11 @@ const postcss = require('postcss')
const _ = require('lodash')
function findColor(colors, color) {
return _.mapKeys(colors, (value, key) => {
const colorsNormalized = _.mapKeys(colors, (value, key) => {
return _.camelCase(key)
})[_.camelCase(color)]
})
return _.get(colorsNormalized, _.camelCase(color), color)
}
module.exports = function ({ colors, backgroundColors }) {