flattenColorPalette() — tailwindcss Function Reference
Architecture documentation for the flattenColorPalette() function in flatten-color-palette.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 17f732a0_9d10_51ac_2acd_c4cc0178d4db["flattenColorPalette()"] fc692362_201d_7126_85aa_6ae8a948d6cc["flatten-color-palette.ts"] 17f732a0_9d10_51ac_2acd_c4cc0178d4db -->|defined in| fc692362_201d_7126_85aa_6ae8a948d6cc 333e8e98_491a_3493_516c_169c024de8d8["entries()"] 17f732a0_9d10_51ac_2acd_c4cc0178d4db -->|calls| 333e8e98_491a_3493_516c_169c024de8d8 style 17f732a0_9d10_51ac_2acd_c4cc0178d4db fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/compat/flatten-color-palette.ts lines 7–30
export default function flattenColorPalette(colors: Colors) {
let result: Record<string, string> = {}
for (let [root, children] of Object.entries(colors ?? {})) {
if (root === '__CSS_VALUES__') continue
if (typeof children === 'object' && children !== null) {
for (let [parent, value] of Object.entries(flattenColorPalette(children))) {
result[`${root}${parent === 'DEFAULT' ? '' : `-${parent}`}`] = value
}
} else {
result[root] = children
}
}
if ('__CSS_VALUES__' in colors) {
for (let [key, value] of Object.entries(colors.__CSS_VALUES__)) {
if ((Number(value) & ThemeOptions.DEFAULT) === 0) {
result[key] = colors[key] as string
}
}
}
return result
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does flattenColorPalette() do?
flattenColorPalette() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/compat/flatten-color-palette.ts.
Where is flattenColorPalette() defined?
flattenColorPalette() is defined in packages/tailwindcss/src/compat/flatten-color-palette.ts at line 7.
What does flattenColorPalette() call?
flattenColorPalette() calls 1 function(s): entries.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free