jaredh159 / tailwind-react-native-classnames

simple, expressive API for tailwindcss + react-native
2.08k stars 84 forks source link

tw.color() doesn't work with dark: mode modifer #224

Closed ahmetbicer closed 1 year ago

ahmetbicer commented 1 year ago

Hey there, this is probably a feature request but when i try to use tw.color() with dark: prefix it doesn't work. For example;

<Svg color={tw.color('bg-red dark:bg-blue')} />

I can workaround this issue with;

<Svg color={tw.prefixMatch('dark') ? tw.color('bg-blue') : tw.color('bg-red')} />

But It would be nice if tw.color() worked with prefixes. Thanks!

jaredh159 commented 1 year ago

yeah, that makes sense, it would be nice if it could handle that.

although it seems a little strange to pass it more than one utility, like what if you tried:

tw.color('bg-red dark:text-blue dark:bg-yellow')

i think because of the ambiguity multiple classes introduces, it's probably best just to have people explicitly test the prefix, like you show in your workaround. 👍