2016-07-21 11:24:00 -08:00
|
|
|
const colorList = [
|
|
|
|
|
'black',
|
|
|
|
|
'red',
|
|
|
|
|
'green',
|
|
|
|
|
'yellow',
|
|
|
|
|
'blue',
|
|
|
|
|
'magenta',
|
|
|
|
|
'cyan',
|
|
|
|
|
'white',
|
|
|
|
|
'lightBlack',
|
|
|
|
|
'lightRed',
|
|
|
|
|
'lightGreen',
|
|
|
|
|
'lightYellow',
|
|
|
|
|
'lightBlue',
|
|
|
|
|
'lightMagenta',
|
|
|
|
|
'lightCyan',
|
|
|
|
|
'lightWhite',
|
|
|
|
|
'colorCubes',
|
|
|
|
|
'grayscale'
|
2016-07-21 19:26:10 -08:00
|
|
|
];
|
2016-07-21 11:24:00 -08:00
|
|
|
|
2018-03-21 01:00:29 -08:00
|
|
|
exports.getColorMap = colors => {
|
|
|
|
|
if (!Array.isArray(colors)) {
|
2016-07-21 11:24:00 -08:00
|
|
|
return colors;
|
|
|
|
|
}
|
2018-03-21 01:00:29 -08:00
|
|
|
return colors.reduce((result, color, index) => {
|
|
|
|
|
if (index < colorList.length) {
|
|
|
|
|
result[colorList[index]] = color;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}, {});
|
|
|
|
|
};
|