-
Notifications
You must be signed in to change notification settings - Fork 666
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
[css-color-4] matching displayed colors between CSS colors and images when those colors are outside the displayable gamut #10055
Comments
also relevant for context are some of the points made here: #7610 |
Thank you for filing this issue! I believe that color matching between CSS, image, video, and canvas is a very important feature. I also have a general uneasiness about any color management system that does not deliver color matching across different input sources. The first two major partners that requested CSS Level 4 from us explicitly wanted color matching between CSS and images (for one) and WebGL canvas (for the other). I have a bit more detail about their exact use cases in this comment, which was an elaboration on this comment. Also of note is the prominence of color matching with images as the motivation in this post. In the current CSS gamut mapping specification, it is impossible for a content author to achieve the same color across CSS, images, video, and canvas. The impossibility of color matching, when it was requested by all partners who had interest in the features of CSS Color Level 4, was the strongest reason for me to be cautious about implementing the current CSS gamut mapping solution. |
I believe it's as simple as specifying the same color using I tried this with two images from https://webkit.org/blog-files/color-gamut/comparison.html, matching the bright yellow and red colors in the images with a background color like The background will be a yellow similar to the flower, and the red will match border of the image. Color matching in this way is a longstanding feature already. |
I think it is extremely important that we always say this with the complete context. It is absolutely possible to color match even when following the specification. Shipping the css-color-4 gamut mapping algorithm does not take away a feature from authors. Authors can also use
Even this post mentions the various ways to use
Yes, that is what currently shipped, not what was specified. Let me try and restate the question. Imagine that implementers actually followed the specification and implemented gamut mapping :) How large is the real world issue of color matching between css colors and images/canvas? Is If this is not sufficient, what is missing? I don't want this to become another thread where we debate the validity of the gamut mapping algorithm :) We already have enough of those. I would like to keep this focused on trying to find ways to make progress. |
No, it is still impossible to ever ensure color matching if CSS gamut mapping is enabled, even with the
These two gamuts are not necessarily the same. There are three cases to consider:
One needs to know the exact gamut that CSS colors are being mapped to. That is a very potent fingerprinting vector. It's also very hard to provide accurately (e.g, print, E-ink displays, and non-3-primary displays don't even have the usual gamut shape). One could try to update the spec to make CSS map to the gamut reported by
The post says the exact opposite. It says: "If you serve wide-gamut images to users not on a wide-gamut display, WebKit will color-match the images and show them in the sRGB space." And then continues: "However, this conversion into sRGB can be done a few ways and isn’t guaranteed to happen identically on other browsers or platforms. As a discerning Web developer or designer you will want to convert your images offline to better control what the end user will see. Also, embedding the color profile adds a little to the file size, so you might not want to send that extra data if it isn’t necessary." That is why the |
I am not sure how we are misunderstanding each other here :)
I am reading : If you care about color accuracy then you should create tailored assets and use the media query to conditionally load the correct asset. Do not leave it up to automatic color matching as it isn't guaranteed to be identical across platforms, hardware, ... Is this an incorrect interpretation, if so, how? |
Can we quantify this? Combined with those authors and users that actually care about exactly matching colors between css, images, ... ? This will help us make a more informed decision about which compromise is better. |
I think I agree, but I want to make sure I'm being as precise as possible. My understanding of what is being written is:
|
I agree with your reading :) What I meant with previous statements is that the So even if CSS and other API's handle out of gamut colors differently it is still possible to have matching in-gamut colors. Even for wider gamut spaces like p3, rec2020. Is there a need for out of gamut color matching? How can we give this as a feature to authors? |
I have asked for help from some ICC folks to put together a wide gamut image with an ICC color profile which provides a perceptual rendering intent. My understanding is that the color of near-boundary but in-sRGB patches in that image will be shifted by the perceptual rendering. We can then also test what browsers do with that image (I have seen assertions that they always do relative colorimetric mapping and thus, that in-gamut colors always match). I don't think we an progress this issue without some actual data, because people have very different opinions, not just on what should happen, but also on what does currently happen. |
see : #9449
@ccameron-chromium said:
I think there is a lot of nuance missing from this statement.
In particular that all colors inside the displayable gamut would still match between CSS and images.
But I agree that having the ability to color match between various features is important to at least some users.
Do users have the needed knobs and dials today to effectively color match between images and CSS colors?
I think they already do with the
color-gamut
media query:It is an involved process, not something that just works.
But it is possible.
An even smaller group of users might want to match colors that are outside the displayable gamut. (e.g. matching midpoints of interpolations in
oklch
to an image)Maybe there should be an opt-out for gamut mapping in CSS?
This could be a keyword on a property that would otherwise limit to a specific gamut, see : #10038
The resulting colors would be clipped values and would be objectively bad, but might be what the other wants.
The text was updated successfully, but these errors were encountered: