L-Blondy / tw-colors

Tailwind plugin to easily add multiple color themes to your projects.
MIT License
464 stars 14 forks source link

Theres a way to use theme variables in javascript files? #46

Closed felipeemarcon closed 2 months ago

felipeemarcon commented 2 months ago

I did not find how to use theme variables created by the plugin in a Javascript file. Could I achieve a result like this? For example:

tailwind.config.ts

...
plugins: [
  createThemes(
    {
      myTheme: {
        'brand': colors.red[500]
      },
      myTheme2: {
        'brand': colors.blue[500]
      }
    }
  ),
]

some-file.tsx

<Component
  ...
  strokeColor={colors.brand}
  fillColor={colors.brand}
/>

Theres a way to do this consuming the definitions from my themes or am I trying to do something that I shouldn't, once that plugin sets the theme from classes and/or data-attribute? I'm not sure if I thinking straight here about that.

L-Blondy commented 2 months ago

There are css variables only, see the docs here

Anyway you should use the class approach. There are stroke and fill utilities