hyper/app/lib/utils/colors.js
Mike 400d70e9df Allow the color config to be an object (#193)
* Allow the `color` config to be an object

It only covers the ANSI 16 as named colors, but allows for an array to
be used if the full color palette wants to be overridden.

* Better handling for array color configs vs. object configs
2016-07-21 12:24:00 -07:00

31 lines
510 B
JavaScript

const colorList = [
'black',
'red',
'green',
'yellow',
'blue',
'magenta',
'cyan',
'white',
'lightBlack',
'lightRed',
'lightGreen',
'lightYellow',
'lightBlue',
'lightMagenta',
'lightCyan',
'lightWhite',
'colorCubes',
'grayscale'
]
export function getColorList (colors) {
// For backwards compatibility, return early if it's already an array
if (Array.isArray(colors)) {
return colors;
}
return colorList.map((colorName) => {
return colors[colorName]
})
}