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

fix(module): allow CSS variables in tailwind colors #2014

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

davestewart
Copy link
Contributor

@davestewart davestewart commented Aug 3, 2024

πŸ”— Linked issue

Closes #1986

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Right now, Nuxt UI expects Tailwind config to use hex values to describe colors.

However, Tailwind's config is actually more flexible, and allows both RGB channel values and CSS variables.

This PR allows the user to pass values other than hex values:

  • HEX are converted to RGB channel values (as before)
  • anything else is returned verbatim

This means if the user passes a variable value, it will:

  • be proxied to the --color-primary-xxx variables
  • be correctly resolved within the 'rgb(var(--color-primary-xxx) / <alpha-value>)' template

If you're happy to merge this, we could do it after #2010 then this could probably be added to the Configuration section.

πŸ‘€ Note

This PR provides a future opportunity to pass / parse additional config values, such as:

'600': 'rgb(123 50 200)',
'900': 'hsl(245 50 50)',

Whether this is wanted or worth the complication is another matter though!

πŸ“ Checklist

@benjamincanac benjamincanac changed the title feat(Config): allow CSS variables in Tailwind config fix(module): allow CSS variables in tailwind config Aug 4, 2024
@davestewart davestewart marked this pull request as ready for review August 5, 2024 10:16
@benjamincanac benjamincanac changed the title fix(module): allow CSS variables in tailwind config feat(module): allow CSS variables in tailwind config Aug 5, 2024
@benjamincanac benjamincanac changed the title feat(module): allow CSS variables in tailwind config feat(module): allow CSS variables in tailwind colors Aug 5, 2024
@github-actions github-actions bot added the stale label Sep 5, 2024
@benjamincanac benjamincanac changed the title feat(module): allow CSS variables in tailwind colors fix(module): allow CSS variables in tailwind colors Sep 10, 2024
@benjamincanac benjamincanac merged commit 7f50c70 into nuxt:dev Sep 16, 2024
2 checks passed
patrick-hofmann pushed a commit to patrick-hofmann/nuxt-ui that referenced this pull request Oct 3, 2024
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.

Tailwind colors with CSS variables results in broken primary/gray palette
2 participants