Skip to content

Commit

Permalink
fix: support named color in arbitrary value
Browse files Browse the repository at this point in the history
  • Loading branch information
sastan committed Mar 20, 2021
1 parent a979005 commit 7f48c59
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/__tests__/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -867,5 +867,6 @@
".rotate-\\[1\\.5turn\\]{--tw-rotate:1.5turn;transform:rotate(1.5turn);transform:translateX(var(--tw-translate-x,0)) translateY(var(--tw-translate-y,0)) rotate(var(--tw-rotate,0)) skewX(var(--tw-skew-x,0)) skewY(var(--tw-skew-y,0)) scaleX(var(--tw-scale-x,1)) scaleY(var(--tw-scale-y,1))}"
],
"duration-[2s]": ".duration-\\[2s\\]{transition-duration:2s}",
"text-[2.23rem]": ".text-\\[2\\.23rem\\]{font-size:2.23rem}"
"text-[2.23rem]": ".text-\\[2\\.23rem\\]{font-size:2.23rem}",
"text-[tomato]": ".text-\\[tomato\\]{color:tomato}"
}
2 changes: 1 addition & 1 deletion src/twind/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const mode = (report: (message: string) => void): Mode => ({
}

// Put it back together
return report(stack.join('at '))
return report(join(stack, 'at '))
},
})

Expand Down
2 changes: 1 addition & 1 deletion src/twind/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ const resolveContext: ThemeSectionResolverContext = {

const handleArbitraryValues = (section: keyof Theme, key: string): string | false =>
(key = (key[0] == '[' && key.slice(-1) == ']' && key.slice(1, -1)) as string) &&
includes(section, 'olor') == (key[0] == '#' || /^(?:#|(?:hsl|rgb)a?\()/.test(key)) &&
includes(section, 'olor') == /^(#|(hsl|rgb)a?\(|[a-z]+$)/.test(key) &&
key

export const makeThemeResolver = (config?: ThemeConfiguration): ThemeResolver => {
Expand Down

0 comments on commit 7f48c59

Please sign in to comment.