UNPKG

tailwindcss

Version:

A utility-first CSS framework for rapidly building custom user interfaces.

14 lines (12 loc) 410 B
const flattenColorPalette = (colors) => Object.assign( {}, ...Object.entries(colors ?? {}).flatMap(([color, values]) => typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({ [color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex, })) : [{ [`${color}`]: values }] ) ) export default flattenColorPalette