Now with a 2nd argument

This commit is contained in:
Rashid Khan 2016-01-04 16:50:56 -07:00
parent 77c31076c2
commit b8e54c865b

View file

@ -41,11 +41,8 @@ define((require) => (Private, config) => {
// Generate a color palette big enough that all new keys can have unique color values
const allColors = _(this.mapping).values().union(configColors).value();
const colorPalette = createColorPalette(allColors.length + keysToMap.length);
const newColors = _.difference(colorPalette, allColors);
while (newColors.length < keysToMap.length) {
newColors.push(_.sample(allColors));
}
let newColors = _.difference(colorPalette, allColors);
newColors = newColors.concat(_.sample(allColors, keysToMap.length - newColors.length));
_.merge(this.mapping, _.zipObject(keysToMap, newColors));
}