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

feat(css): add missing css color-mix() function #857

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

skyclouds2001
Copy link
Contributor

Description

the css color-mix() function has been supported in all major platform for more than one year per bcd

Motivation

Additional details

https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix
https://drafts.csswg.org/css-color-5/#funcdef-color-mix

Related issues and pull requests

report in csstree/validator#29

@skyclouds2001
Copy link
Contributor Author

skyclouds2001 commented Dec 26, 2024

full test log in chromium:

CSS.supports('color', 'color-mix(in oklab, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in srgb, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in srgb-linear, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in display-p3, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in a98-rgb, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in prophoto-rgb, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in rec2020, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in lab, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in oklab, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in xyz, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in xyz-d50, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in xyz-d65, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in hsl, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in hwb, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in lch, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in oklch, #a71e14 0%, white)')
true
CSS.supports('color', 'color-mix(in lch shorter hue, var(--base) 0%, var(--mixin) )')
true
CSS.supports('color', 'color-mix(in lch longer hue, var(--base) 0%, var(--mixin) )')
true
CSS.supports('color', 'color-mix(in lch increasing hue, var(--base) 0%, var(--mixin) )')
true
CSS.supports('color', 'color-mix(in lch decreasing hue, var(--base) 0%, var(--mixin) )')
true
CSS.supports('color', 'color-mix(in --swop5c, var(--base) 0%, var(--mixin) )')
true
CSS.supports('color', 'color-mix(in --my-color-profile, var(--base) 0%, var(--mixin) )')
true

Note

Though the <custom-color-space> syntax of <color-interpolation-method> syntax, which should be defined using non-supported @color-profile feature. Test shows that this syntax is supported in color-mix(), so added this at present.

@skyclouds2001 skyclouds2001 marked this pull request as ready for review December 26, 2024 06:54
@skyclouds2001 skyclouds2001 requested a review from a team as a code owner December 26, 2024 06:54
@skyclouds2001 skyclouds2001 requested review from bsmth and removed request for a team December 26, 2024 06:54
@bsmth bsmth added the conflicts PR has merge conflicts label Jan 8, 2025
@bsmth
Copy link
Member

bsmth commented Jan 8, 2025

Do you want to have a look at the merge conflicts? It's probably quicker for you on this one :)

"syntax": "in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? ]"
"syntax": "in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? | <custom-color-space> ]"
},
"color-mix()": {
Copy link
Member

Choose a reason for hiding this comment

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

What's the purpose in duplicating the color-mix() entry here, also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is simply the current behavior, see #811, to have css functions both in syntaxes.json and functions.json

change it may bring break change

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, this is again another case for mirroring members

Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

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

All looks correct, one clarifying question before we merge

@bsmth bsmth removed the conflicts PR has merge conflicts label Jan 10, 2025
@bsmth bsmth merged commit 3fe902e into mdn:main Jan 10, 2025
3 checks passed
@skyclouds2001 skyclouds2001 deleted the color-mix branch January 11, 2025 13:21
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

Successfully merging this pull request may close these issues.

2 participants