flatten-color-palette.ts — tailwindcss Source File
Architecture documentation for flatten-color-palette.ts, a typescript file in the tailwindcss codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR fc692362_201d_7126_85aa_6ae8a948d6cc["flatten-color-palette.ts"] e28cd4a7_4e1a_e79b_76f1_86c479c6640d["theme.ts"] fc692362_201d_7126_85aa_6ae8a948d6cc --> e28cd4a7_4e1a_e79b_76f1_86c479c6640d f504aa6c_d026_cb8e_0a17_653514de8526["ThemeOptions"] fc692362_201d_7126_85aa_6ae8a948d6cc --> f504aa6c_d026_cb8e_0a17_653514de8526 79e55422_077b_cc18_428e_522cf1765560["config.test.ts"] 79e55422_077b_cc18_428e_522cf1765560 --> fc692362_201d_7126_85aa_6ae8a948d6cc 9f3e0e70_356f_b930_a9c3_35bc63000981["flatten-color-palette.test.ts"] 9f3e0e70_356f_b930_a9c3_35bc63000981 --> fc692362_201d_7126_85aa_6ae8a948d6cc style fc692362_201d_7126_85aa_6ae8a948d6cc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { ThemeOptions } from '../theme'
type Colors = {
[key: string | number]: string | Colors
}
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
Functions
Types
Dependencies
Imported By
Source
Frequently Asked Questions
What does flatten-color-palette.ts do?
flatten-color-palette.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Extractor subdomain.
What functions are defined in flatten-color-palette.ts?
flatten-color-palette.ts defines 1 function(s): flattenColorPalette.
What does flatten-color-palette.ts depend on?
flatten-color-palette.ts imports 2 module(s): ThemeOptions, theme.ts.
What files import flatten-color-palette.ts?
flatten-color-palette.ts is imported by 2 file(s): config.test.ts, flatten-color-palette.test.ts.
Where is flatten-color-palette.ts in the architecture?
flatten-color-palette.ts is located at packages/tailwindcss/src/compat/flatten-color-palette.ts (domain: Oxide, subdomain: Extractor, directory: packages/tailwindcss/src/compat).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free