Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.11k stars 678 forks source link

Tailwind color codes are incompatible #2155

Closed andreasnuesslein closed 4 months ago

andreasnuesslein commented 4 months ago

Hi all!, thanks for weasyprint :heart:

So, I'm using weasyprint v62.1 with Tailwind 3.4.1, and the issue that I'm having is that all the color codes Tailwind generates seem to be incompatible.

First I thought it was #1998 but it turns out the problem seems to be different.

Tailwind takes e.g. bg-red-500 and turns it into this:

background-color: rgb(239 68 68 / var(--tw-bg-opacity));

which does not render. I can however force Tailwind to put / 1 by using bg-red-500/100, which gives me:

background-color: rgb(239 68 68 / 1);

Both don't work.

The problem seems to be the format. If I manually put:

background-color: rgba(239,68,68,1);

it works.

(I'm gonna see if I can tell tailwind to use the other format.)

Thank you!

andreasnuesslein commented 4 months ago

okay, using postcss-preset-env fixed that issue too, after all. it generates the required rgba(239, 68, 68, 1);

liZe commented 4 months ago

Hi!

Thank you for this report. This is actually a missing feature of tinycss2 (https://github.com/Kozea/tinycss2/issues/47), and a duplicate of #1630.