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

Add CSS Color Module Level 5 (color-mix(), color-contrast(), Relative color) #5405

Closed
Schweinepriester opened this issue May 1, 2020 · 19 comments

Comments

@Schweinepriester
Copy link
Contributor

Schweinepriester commented May 1, 2020


@Schweinepriester
Copy link
Contributor Author

Two are coming as experimental with Safari TP 122:

  • Added experimental support for CSS Color 5 color-contrast() (r273683)
  • Added experimental support for CSS Color 5 color-mix() (r273244)
@Schweinepriester Schweinepriester changed the title Add CSS Color Module Level 5 (color-adjust(), color-mix(), color-contrast()) Nov 26, 2021
@Schweinepriester Schweinepriester changed the title Add CSS Color Module Level 5 (~~color-adjust()~~, color-mix(), color-contrast(), Relative color) Nov 26, 2021
@Schweinepriester
Copy link
Contributor Author

Support bugs, stolen from https://www.bram.us/2021/12/27/css-in-2022/#the-hotlist--color-functions:

@GPHemsley
Copy link

With color-adjust() removed from the spec and color-mix() and color-contrast() being covered by MDN data (via mdn/browser-compat-data#9489, mdn/browser-compat-data#12039), that appears to leave this issue only covering relative colors.

The spec also defines @color-profile and device-cmyk(), but both already have an MDN page, so they're likely to be covered by MDN data in the future:
https://developer.mozilla.org/en-US/docs/Web/CSS/@color-profile
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/device-cmyk()

@Schweinepriester
Copy link
Contributor Author

that appears to leave this issue only covering relative colors.

Check!

The spec also defines @color-profile and device-cmyk(), but both already have an MDN page, so they're likely to be covered by MDN data in the future

Good to know!
Those have also separate issues:

@mangelozzi
Copy link

mangelozzi commented May 27, 2022

Please give us the ability to be able to set the opacity of a custom property that is set to a hex color code. This is propably the most common use case for color adjustments.
If you have a theme, each color is one variable (a hex color code), not 3 x RGB values one has to keep track of.

188K designers have sought for a fix for this on stackoverflow:
https://stackoverflow.com/questions/40010597/how-do-i-apply-opacity-to-a-css-color-variable

:root {
  --color: #f0f0f0;
}

#element {
  background: (somehow use var(--color) at some opacity);
}
@LifeIsStrange
Copy link

@mangelozzi I think you should voice this pain point at https://github.com/w3c/csswg-drafts/labels/css-color-5
More generally, methodically looking at the most popular CSS stackoverflow questions that have unsatisfying answers, and reporting them on the CSS specs working group would be a way to yield dramatically significant, reality-aligned improvements to CSS.

@Ugoku
Copy link
Contributor

Ugoku commented Oct 12, 2022

Links for relative colors:

@Ugoku
Copy link
Contributor

Ugoku commented Oct 31, 2022

Links to issues for color-contrast:

@Schweinepriester
Copy link
Contributor Author

@jensimmons
Copy link
Contributor

Let's get these pages on Can I Use!

@jensimmons
Copy link
Contributor

Safari 16.2 added support for color-mix() back in December 2022.

@jensimmons
Copy link
Contributor

Safari 16.4 beta has support for Relative Color Syntax.

@clairity
Copy link

yes, please add relative color syntax to caniuse! i've been checking for it periodically and end up slapping my forehead each time thinking i wasn't putting in the right incantations into the search box, to then finally realize it's not in there at all yet.

@controversial
Copy link
Contributor

Safari 16.4 shipped with support for relative color at the end of March

@jensimmons
Copy link
Contributor

Someone needs to make three pull-requests.

What is the current state of all the other browser support? Does Chrome/Edge/other Chromium mobile browsers or Firefox support any of these three new features? Even in partial experimental state?

Can anyone find issues for Chromium and Gecko so we can link to them?

Are there any MDN pages yet?

@Schweinepriester
Copy link
Contributor Author

@jensimmons To my understanding the only thing missing from caniuse covered by this issue is relative color, with the rest being available via MDN:

Issues for relative color (comment above):

Links for relative colors:

Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1274133
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1701488

@Fyrd
Copy link
Owner

Fyrd commented May 1, 2023

Relative color syntax now available at https://caniuse.com/css-relative-colors

Closing this ticket now as all appear to be accounted for now, thanks all for helping to provide info. :)

@Fyrd Fyrd closed this as completed May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment