- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Wed, 08 Feb 2023 18:02:34 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[css-color-6] color-contrast() should take transparency into account`. <details><summary>The full IRC log of that discussion</summary> <TabAtkins> lea: We've discussed before. Right now contrast-color() ignores transparency entirely, pretends the colors are opaque.<br> <TabAtkins> lea: This can produce wildly wrong results.<br> <TabAtkins> lea: A color with a very low alpha but otherwise has a good contrast, the algo can choose that over an opaque color that would *actually* contrast better<br> <TabAtkins> lea: Previously we resolved that you composite a semi-transparent fg against the bg, but we didn't resolve on what to composite the bg against<br> <TabAtkins> lea: There are three options<br> <TabAtkins> lea: (1) the opaque version fo the fg<br> <TabAtkins> lea: (2) opaque white or balck, whichever is better<br> <TabAtkins> lea: (3) canvas color<br> <TabAtkins> lea: Or a UA-specified color.<br> <TabAtkins> lea: So we ahve to resolve on the color and we'll have a complete algo<br> <fantasai> s/Or a UA-specified color/(4) Color picked by UA to minimize the contrast (per contrast algo specified)<br> <TabAtkins> lea: Whatever heuristic we pick it might be wrong, so it might also be useful in a later version to add a color-over() that specifies the compositing...<br> <argyle> q+<br> <TabAtkins> TabAtkins: Weak preference for canvas color<br> <TabAtkins> chris: Me too, seems canvas color is a good default, takes light/dark mode into account<br> <TabAtkins> fantasai: Seems like it could be wronger than fg<br> <TabAtkins> chris: fg is gonna be the worst possible<br> <TabAtkins> fantasai: color could be in a subtree with a different color than canvas<br> <astearns> ack argyle<br> <TabAtkins> dbaron: I think it's posible to come up with an algorithm for "worst possible color" but not sure it's any of these<br> <fantasai> fantasai^: fg is not always worst possible, depends on the composited background<br> <TabAtkins> argyle: I'm remdined of accent color - we compute it against canvas color<br> <TabAtkins> argyle: I think it would be nice to have a fallback mechanism where it falls back to canvas if there's not an html or body color<br> <TabAtkins> argyle: So it could crawl up and try to find a solid color, otherwise use the UA canvas<br> <smfr> q+<br> <astearns> ack fantasai<br> <TabAtkins> fantasai: I don't think we can look for the actual bg - frequently you're rendering over an image<br> <TabAtkins> fantasai: and we want to do this locally without having to do layout or crawl the tree<br> <TabAtkins> fantasai: so i think we need an answer locally based on infromation on the element itself<br> <astearns> ack smfr<br> <TabAtkins> smfr: I think we're assumign that contrast is used on the fg of an element.<br> <TabAtkins> smfr: But might want to use it for the bg - seems like we're biasing<br> <argyle> i just used color-contrast() on the bg in this demo https://nerdy.dev/color-from-color-contrast-result<br> <TabAtkins> chris: We're actually not doing that - we're explicit about whether the color is a fg or bg<br> <TabAtkins> chris: So this is only an issue where it's the bg color that's partially transparent<br> <astearns> ack fantasai<br> <TabAtkins> fantasai: I think i'd prefer we went with opacified fg, or "UA-chosen worst possible color"<br> <argyle> q+<br> <TabAtkins> fantasai: We're trying to find a color that passes a threshold for some contrast<br> <astearns> ack argyle<br> <TabAtkins> argyle: What if we added an option for users to specify it?<br> <chris> color picked by the UA sounds handwavy, difficult to test, non-interoperable<br> <chris> q+<br> <TabAtkins> argyle: Like it defautls to canvas, but as an author I know what color it's gonna be against<br> <fantasai> chris, it's "color picked by the UA to minimize contrast per the contrast algo used"<br> <TabAtkins> argyle: So authors can add intelligence but we still have a reasonable default<br> <fantasai> which is not so vague<br> <astearns> ack chris<br> <TabAtkins> chris: I see what Adam's suggesting, but I think putting the same color in twice means you ahve to update it twice and keep in sync<br> <TabAtkins> argyle: Custom props is your way out of that - already this algo is loaded with inputs that need copy/paste or custom props<br> <TabAtkins> lea: Even using the custom prop is some repetition<br> <dbaron> Seems like what Adam's suggesting could also be done with a composite(A over B) color function or similar rather than additional syntax for the contrast function.<br> <TabAtkins> lea: Remembering which of the custom colors you're using<br> <TabAtkins> lea: Does seem nice as optional, but shouldn't be only way<br> <TabAtkins> astearns: We're over time, and I'm not hearing consensus, so let's take back to issue<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7358#issuecomment-1423028597 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 8 February 2023 18:02:36 UTC