From c04a3b26c6b1859bf77df6a84936c95b457bf65c Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 25 Aug 2017 10:17:28 -0400 Subject: [PATCH] Add support for mixed "plain color string" and "color map" background defintitions Lets you do this: ``` backgroundColors: [ 'blue', 'purple', 'pink', { primary: 'white', secondary: 'orange', }, ] ``` --- src/generators/background-colors.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/generators/background-colors.js b/src/generators/background-colors.js index 9d4d39bec..628c7b4fc 100644 --- a/src/generators/background-colors.js +++ b/src/generators/background-colors.js @@ -11,7 +11,12 @@ function findColor(colors, color) { module.exports = function ({ colors, backgroundColors }) { if (_.isArray(backgroundColors)) { - backgroundColors = _(backgroundColors).map(color => [color, color]).fromPairs() + backgroundColors = _(backgroundColors).flatMap(color => { + if (_.isString(color)) { + return [[color, color]] + } + return _.toPairs(color) + }).fromPairs() } return _(backgroundColors).toPairs().map(([className, colorName]) => {