Skip to content

only produce valid fallback values #1187

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

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Nov 30, 2023

fixes : #1185

@@ -212,7 +212,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
}

.test-color-functional-notation {
color: rgba(178, 34, 34, 0.5);
color: rgba(179, 34, 34, 0.5);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was always wrong, the color package is much more correct than what existed in the functional notation plugin.

@@ -1,6 +1,6 @@
import type { Node, AtRule } from 'postcss';

const supportsCheck = /(\(color: rgb(a?)\(0 0 0 \/ 0)|(\(color: hsl(a?)\(0 0% 0% \/ 0)/i;
export const rgb_hsl_functionRegex = /(?:rgb|hsl)a?\(/i;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to avoid hard coding to much of the supports conditions.
A simplistic check is fine here.

@@ -99,7 +103,7 @@ const postcssPlugin: PluginCreator<pluginOptions> = (opts?: pluginOptions) => {

if (options.enableProgressiveCustomProperties && options.preserve) {
return {
postcssPlugin: 'postcss-color-function',
postcssPlugin: 'postcss-color-functional-notation',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some unfortunate copy/paste in the past.

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work!

@romainmenke romainmenke merged commit cc3b9b7 into main Dec 4, 2023
@romainmenke romainmenke deleted the functional-notation-only-produce-valid-fallbacks--passionate-platypus-2c23f90111 branch December 4, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Color functional notation breaks values with mixed components
2 participants