Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call color functions when using theme('...') on all color related sections. #4533

Closed
wants to merge 2 commits into from
Closed

Conversation

crswll
Copy link

@crswll crswll commented Jun 1, 2021

We noticed we were able to do:

.test {
  color: theme('colors.someFunction')
}

but we were unable to do:

.test {
  color: theme('textColor.someFunction')
}

so this resolves that.

I left a few comments below because I feel like I'll need to adjust a bit.

@@ -13,15 +13,14 @@ export default function transformThemeValue(themeSection) {
'transitionTimingFunction',
'backgroundImage',
'backgroundSize',
'backgroundColor',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having a hard time understanding why this was here. I removed it and it didn't break any tests so that's good but I can't help but feel like I'm missing something.

'cursor',
'animation',
].includes(themeSection)
) {
return (value) => (Array.isArray(value) ? value.join(', ') : value)
}

if (themeSection === 'colors') {
if (['colors', 'textColor', 'backgroundColor', 'borderColor'].includes(themeSection)) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do something less explicit here like themeSection === 'colors' || themeSection.toLowerCase().endsWith('color')?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer to be explicit personally. We are missing a bunch of things in this list though, like divideColor, gradientColorStops, placeholderColor, ringColor, ringOffsetColor, fill, stroke, and the brand new caretColor plugin so will want to get updated for those.

This is probably going to be annoying to maintain so might be worth thinking through a strategy that is more automatic but I don't have any good ideas that immediately come to mind :/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the other items for now and alphabetized. Everything I can think of feels either limiting or gross right now. Will think about it a bit more.

@RobinMalfait
Copy link
Contributor

Hey! Thank you for your PR!
Much appreciated! 🙏

I had to rebase, and made some changes. I didn't have access rights to push directly to your branch, so I create a new PR and started from your commits: #5871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants