Skip to content

Commit a07301a

Browse files
committed
chore: allow for multi-segment color names
1 parent 78be83a commit a07301a

2 files changed

Lines changed: 503 additions & 4 deletions

File tree

packages/headwind/src/rules.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,12 @@ export const colorRule: UtilityRule = (parsed, config) => {
301301
return { [prop]: specialColors[colorValue] }
302302
}
303303

304-
// Parse color value: "blue-500" -> colors.blue[500]
304+
// Parse color value: "blue-500" or "blue-gray-50" -> colors.blue[500] or colors['blue-gray'][50]
305305
const parts = colorValue.split('-')
306-
if (parts.length === 2) {
307-
const [colorName, shade] = parts
306+
if (parts.length >= 2) {
307+
// Last part should be the shade, everything before is the color name
308+
const shade = parts[parts.length - 1]
309+
const colorName = parts.slice(0, -1).join('-')
308310
const themeColorValue = config.theme.colors[colorName]
309311
if (typeof themeColorValue === 'object' && themeColorValue[shade]) {
310312
const finalColor = opacity !== undefined

0 commit comments

Comments
 (0)