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:
parent
8e7b2dc1fa
commit
c84f0ec4b7
1 changed files with 4 additions and 2 deletions
|
|
@ -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 }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue