Skip to content

postcss-color-functional-notation unexpectedly not working #978

Closed
@satouriko

Description

@satouriko

Bug description

Hi there, I found that with the default postcss-preset-env, case

.text-link {
  --tw-text-opacity: 1;
  color: rgba(87 107 149 / var(--tw-text-opacity));
}

will be downgrade by custom-properties to

.text-link {
  --tw-text-opacity: 1;
  color: #576b95;
  color: rgb(87 107 149 / var(--tw-text-opacity));
}

and will not further downgrade by postcss-color-functional-notation to

.text-link {
  --tw-text-opacity: 1;
  color: #576b95;
  color: rgba(87,107,149,var(--tw-text-opacity));
}

after postcss-color-functional-notation@5.0.2 because of #835

This makes users between the gap (e.g Chorme 49~64) cannot display color correctly, and there seems no option to override

https://caniuse.com/css-variables
https://caniuse.com/?search=space-separated

Source CSS

.text-link {
  --tw-text-opacity: 1;
  color: rgba(87,107,149,var(--tw-text-opacity));
}

Expected CSS

.text-link {
  --tw-text-opacity: 1;
  color: #576b95;
  color: rgba(87,107,149,var(--tw-text-opacity));
}

Actual CSS

.text-link {
  --tw-text-opacity: 1;
  color: #576b95;
  color: rgb(87 107 149/var(--tw-text-opacity));
}

Does it happen with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

N/A

Debug output

No response

Extra config

No response

What plugin are you experiencing this issue on?

PostCSS Color Functional Notation

Plugin version

5.0.2

What OS are you experiencing this on?

No response

Node Version

v16.15.1

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions