mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-07 03:09:14 +08:00
13 lines
410 B
Text
13 lines
410 B
Text
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
|