-
Notifications
You must be signed in to change notification settings - Fork 658
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-background-4] Switch to opt into transparent canvas for additive displays #3949
Comments
Black or white being transparent on passthru screens and the like is already allowed just in general. |
@tabatkins I don't follow. We want authors to opt their pages into being transparent using the meta tag. |
I think for transparent displays, the root color of the canvas should be transparent and not black but I'd like that to be reflected in the spec. |
What I mean is, transparent displays already are allowed to handle CSS's black (or white, depending on the nature of the screen) by instead rendering transparently. We even have a proposed MQ in level 5 to expose when this is happening: https://drafts.csswg.org/mediaqueries-5/#environment-blending So 'color-scheme' doesn't have any effect on this. |
I know of that one (since I proposed it :-)) Since it's a media query, it doesn't change anything; it just allows switching to a different style for transparent devices. environment-blending doesn't influence the color of the canvas backdrop since it's specified to be white or black for now. I'm happy to change our implementation to so the canvas is transparent for dark mode when the meta tag is present but would like to see that reflected in the spec. Just to be clear: this is not about how to handle the black color, this is about the default canvas color (= the color on which all the elements are painted) |
Right; I'm definitely not saying that the MQ changes anything about the page! What I'm saying is that the existence of the MQ implies that rendering engines can already render black/white as transparent, if that's ideal for their display. There's nothing stopping you from rendering any way you'd like, as long as it makes your users happy.
Sure. Similar story tho. Color Adjust does not prescribe any particular colors, it just gives guidelines for what "light" and "dark" should mean. If a transparent canvas is the best way for your display to implement a "dark" mode, then go for it. |
@cabanier guessing you might get clarification by adding your questions to the discussion in #3983? Also,
|
That wording is...odd and not in line with the css color spec. |
Can you elaborate? What do you think contradicts it in CSS Color? |
As discussed in github issue 3949[1], we should not set the canvas color to black if the view is forced transparent, like it wouldn't be white in the default scheme. [1] w3c/csswg-drafts#3949 Change-Id: I33ff79c17c245a9cbae3a5602d2240361fca293d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643575 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/master@{#666216}
css-color specifies that the color of the document canvas is recommended to be white. Maybe these are 2 different definitions of 'canvas'? |
@cabanier There does seem to be some confusing wording. CSS Backgrounds (like CSS2 before it) assumes the canvas has a "background", which is taken from the root element and painted over whatever the UA has below that. CSS Color calls that UA default the "color" of the canvas. It seems we need a clearly defined term for the color of the canvas underneath the background specified by the root element to avoid the confusion between the two concepts. (But in any case, the specs do not conflict.) |
I agree. From CSS Color:
We need to define what "the surface on which the document is painted" is called. |
Maybe "canvas surface" as opposed to "canvas background"? |
sound good. Then white is the initial canvas surface color with an option of making it black or transparent. |
s/white/Canvas/ https://drafts.csswg.org/css-color-4/#valdef-system-color-canvas but yes :) |
Partly :-) |
This also applies to fxtf filters; it may be worth making the same change there. |
What do you mean by "this"? Filter and blending operations must be independent of the initial canvas surface color |
Sorry, that was half-remembered. I've just checked my notes; specifically it was the However on re-reading this issue and To sum up: please ignore my earlier comment. |
That would be incorrect. The default stylesheet for the root is transparent. You can see it in this codepen: https://jsfiddle.net/2vf1d6jt/
Changing the color of the canvas surface will not change document colors. It's a special case that needs to be handled differently. |
@cabanier It isn't always white, though. Sometimes it's transparent. :) Isn't that what you wanted when filing this bug originally, to allow the canvas to be transparent? |
It's sometimes black, if there's a meta tag for dark mode :-)
yes, I wanted a meta tag to opt into transparent. Since then, a meta tag for dark mode was proposed and @tabatkins said that it could be used to signal transparent on certain UAs. I'm unsure that's the right approach though... |
…om what lies underneath. w3c#3949
…rom what lies underneath. w3c#3949
It would be nice if we used a term other than "canvas" in this discussion. "Surface" was suggested above. We're talking about the color (or, in this case, lack of color) used for the surface of the final rendering/compositing destination. |
I'd like to know what is expected to happen on a pass-through display for a page that the user requests to be shown in mode other than the default. e.g. a white background is normally not rendered on this device - if the user requests dark mode for a page, should they now see the background? |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-background-4] Switch to opt into transparent canvas for additive displays<dael> github: https://github.com//issues/3949 <dael> Rossen_: Brought up by Rik. I don't believe he's on the call <dael> Rossen_: Silence suggests no <dael> Rossen_: Anyone here who wants to take this? <dael> dino: I asked some questions, but I don't think it needs to be discussed <dael> myles: I think call doesn't have right people <dael> Rossen_: Doesn't feel like it <dael> dino: Unless you just want me to make a decision ^-^ <dael> dino: General use case makes sense. I haven't quite understood behavior and what people would expect with meta tag. I look forward to a bit more explination <dael> Rossen_: This'll go in minutes, hopefully more will come in github |
That's right. "canvas" is what is used in the spec so if we start talking about surface, people might think they are 2 different things |
|
That's good. But what about a "fake" additive device. e.g. it's showing a camera feed on the display, and the web content floats above that. Most of the time you'd want a solid background, but I can imagine widgets and other smaller UIs would want to cut through. This also makes me wonder what happens to partially transparent backgrounds. |
That's not an additive device since it can blend the web content with the real world using
If you want parts to push through (and leave the initial background opaque), I don't think there's currently a way to do this.
I'm unsure why those are special. Can you list the scenario you're thinking of? |
To elaborate on my previous reply, a device that combines the background with the web content in hardware, could support dark mode and a transparent surface/canvas but it would depend on the brightness of the environment if light or dark mode would work well. |
One idea is an additional |
Yes, if a page is transparent, it makes sense to have an additional color scheme for it. |
@cabanier this one keeps going on the agenda then getting passed over because you aren’t on the call. Could we either get things to a point where we could resolve something on this issue in your absence, or have you commit to a particular meeting? Both at once would be best :) |
Because I switched companies, I'm no longer a member of the CSSWG. Is this important enough for me to join? |
On passthrough devices such as Magic Leap One or Hololens, the browsing experience in "dark" mode is more pleasant if the browser canvas itself is transparent.
By default, the canvas is white and the [css-color-adjust] spec just inverts that to black.
Can there be a way for an author to specify that the canvas color is transparent? Or can the canvas always be transparent for passthrough devices?
The text was updated successfully, but these errors were encountered: