jaredh159 / tailwind-react-native-classnames

simple, expressive API for tailwindcss + react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ahmetbicer opened this issue · comments

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!

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. 👍