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

Default border color of tailwind dont match with twin.macro #609

Closed
azharakbar opened this issue Jan 11, 2022 · 8 comments
Closed

Default border color of tailwind dont match with twin.macro #609

azharakbar opened this issue Jan 11, 2022 · 8 comments

Comments

@azharakbar
Copy link

Hi,

The default border color in TailwindCSS v3.0 is

border-color: rgb(229 231 235 / var(--tw-border-opacity));

But in twin.macro @ v2.8.2,
it is

border-color: currentColor;

Please fix this

Sample Code

export const StyledElement= tw.a`
    border
`;
@azharakbar
Copy link
Author

Or is there any workaround currently in 2.8.2 to update the defaults with Tailwind3 ?
@ben-rogerson

@zslabs
Copy link

zslabs commented Jan 12, 2022

This library is currently being updated to support Tailwind v3. For now, use a 2.x.x version of Tailwind. Follow #589 for more details.

@azharakbar
Copy link
Author

@zslabs Thanks for the update
But, which one in the list of changes that are to be done relates to the default border-color fix?

@ben-rogerson
Copy link
Owner

ben-rogerson commented Jan 13, 2022

The default border color in twin.macro@2.8.2 is set within the global styles and it works the same way in tailwindcss@v3.

You can set it with the default value in your tailwind config:

module.exports = {
  theme: {
    extend: {
      borderColor: {
        DEFAULT: 'currentColor',
      },
    },
  },
}
import { globalStyles } from "twin.macro";
globalStyles

// ↓ ↓ ↓ ↓ ↓ ↓

"*, ::before, ::after": {
    // ...
    "borderColor": "currentColor",
    // ...

The difference between the versions seems to be:

// v3
border-color: rgb(229 231 235 / var(--tw-border-opacity));

// v2
border-color: rgba(229, 231, 235, var(--tw-border-opacity));

These will be updated in the next version of twin.

@azharakbar
Copy link
Author

@ben-rogerson
Hi,
Unfortunately, I was not able to override the defaults of twin.macro

I have changed tailwind.config.js to update the defaults
image

But still i get currentColor as the default from twin.macro
image

@azharakbar
Copy link
Author

And also, what is the usecase of stiches ?

@ben-rogerson
Copy link
Owner

ben-rogerson commented Jan 14, 2022

Just came across this patch from v3.0.12 - the fallback was changed to currentColor.

I'll make sure this is added in the v3 updates, follow along in #589

Stitches is a newer css-in-js library with a different api than emotion/styled-components. Check out their docs for more.

@ben-rogerson
Copy link
Owner

Closing this for now, after the next twin update, if this still doesn't sync with the latest version of tailwindcss, feel free to reopen.

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

No branches or pull requests

3 participants