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

Can I add a default color on a theme with the theme function? #5

Closed
prpanto opened this issue Feb 24, 2023 · 2 comments
Closed

Can I add a default color on a theme with the theme function? #5

prpanto opened this issue Feb 24, 2023 · 2 comments

Comments

@prpanto
Copy link

prpanto commented Feb 24, 2023

I want to use the default tailwind color as a theme but I dont want to copy past the hex code. Is there any way to achieve the above code:

   const { createThemes } = require('tw-colors');

   module.exports = {
      // ...your tailwind config
      plugins: [
         createThemes((theme) => {
             light: { 
               'emerald': theme('emerald.600'),
               'blue': theme('blue.600'),
            },
         })
      ],
   };
``
@L-Blondy
Copy link
Owner

@prpanto you can simply import tailwind's default color palette and use it as follows:

   const { createThemes } = require('tw-colors');
   const colors = require('tailwindcss/colors');

   module.exports = {
      // ...your tailwind config
      plugins: [
         createThemes((theme) => {
             light: { 
               'emerald': colors.emerald[600],
               'blue': colors.blue[600],
            },
         })
      ],
   };

Hope that helps!

@prpanto
Copy link
Author

prpanto commented Feb 24, 2023

Thanks for this. I forget that you can call the colors.

@prpanto prpanto closed this as completed Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants