Skip to content

Commit b84eceb

Browse files
committed
decision getThemePath
1 parent 3fb462d commit b84eceb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/bin/css_to_ts/colorDecisions.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,24 @@ export function createParseColorDecisionName(params: {
123123

124124
return { parseColorDecisionName };
125125
}
126+
127+
/**
128+
* Exported only for tests
129+
*
130+
* getThemePath(createParseColorDecisionName("--background-alt-raised-grey-hover"))
131+
* ->
132+
* ["background", "altRaised", "normal", "grey", "hover"]
133+
*
134+
* getThemePath(createParseColorDecisionName("--border-action-low-orange-terre-battue"))
135+
* ->
136+
* ["border", "action", "low", "orangeTerreBattue", "default"]
137+
*/
138+
export function getThemePath(parsedColorDecisionName: ParsedColorDecisionName) {
139+
return [
140+
parsedColorDecisionName.context,
141+
parsedColorDecisionName.usage,
142+
parsedColorDecisionName.variant ?? "normal",
143+
parsedColorDecisionName.colorName,
144+
parsedColorDecisionName.state ?? "default"
145+
];
146+
}

0 commit comments

Comments
 (0)