mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-25 16:44:12 +00:00
14 lines
404 B
JavaScript
14 lines
404 B
JavaScript
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
|