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): handle nested colors from ui config #2008

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

davestewart
Copy link
Contributor

@davestewart davestewart commented Aug 2, 2024

πŸ”— Linked issue

Resolves #1411

❓ 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, the config for ui.primary and ui.gray only allows the user to choose from top-level colors.

This tiny fix allows them to choose nested color groups, such as brand.primary:

// tailwind.config.js
export default <Partial<Config>>{
  theme: {
    extend: {
      colors: {
        red: { ... },
        green: { ... },
        brand: {
          primary: { ... },
          secondary: { ... },
          accent: { ... },
          ...
        },
      },
    },
  },
}
// app.config.js
export default defineAppConfig({
  ui: {
    primary: 'brand.primary',
    gray: 'brand.secondary'
  }
})

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac
Copy link
Member

Thanks for the PR! This does solve #1411 right?

@davestewart
Copy link
Contributor Author

Yes it does!

@davestewart davestewart changed the title feat(Theming): target nested colors from ui config fix(Theming): allow nested colors from ui config Aug 2, 2024
@benjamincanac benjamincanac changed the title fix(Theming): allow nested colors from ui config fix(module): handle nested colors from ui config Aug 2, 2024
@benjamincanac benjamincanac merged commit 1cc7e2a into nuxt:dev Aug 2, 2024
2 checks passed
davestewart added a commit to davestewart/nuxt-ui that referenced this pull request Aug 2, 2024
* dev:
  fix(module): handle nested colors from ui config (nuxt#2008)
davestewart added a commit to davestewart/nuxt-ui that referenced this pull request Aug 2, 2024
* dev:
  fix(module): handle nested colors from ui config (nuxt#2008)
@davestewart davestewart deleted the feat/nested-config-colors branch August 2, 2024 13:50
binhtranhuu pushed a commit to binhtranhuu/nuxt-ui that referenced this pull request Aug 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.

Extending tailwind colors with nested names won't work with custom primary color
2 participants