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

CSS AccentColor and AccentColorText system colors #136

Open
lukewarlow opened this issue Feb 19, 2023 · 13 comments
Open

CSS AccentColor and AccentColorText system colors #136

lukewarlow opened this issue Feb 19, 2023 · 13 comments
Assignees
Labels
concerns: privacy This proposal may cause privacy risk if implemented topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG

Comments

@lukewarlow
Copy link
Member

lukewarlow commented Feb 19, 2023

Request for position on an emerging web specification

  • WebKittens who can provide input:

Information about the specification

Design reviews and vendor positions

  • TAG Design Review:

Mozilla has shipped to stable release

Bugs tracking this feature

Anything else we need to know

These would add a standard way to access accent color information that's already exposed through prefixed properties such as -webkit-focus-ring-color.

@lukewarlow
Copy link
Member Author

Just realised this is implemented but returns a hardcoded value, so not sure if this issue is relevant.

@annevk annevk added topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG labels Feb 24, 2023
@hober hober moved this from Unscreened to Needs position in Standards Positions Review Backlog Mar 23, 2023
@hober hober moved this from Needs position to Needs assignees in Standards Positions Review Backlog Mar 27, 2023
@hober hober moved this from Needs assignees to Needs position in Standards Positions Review Backlog Mar 27, 2023
@o-t-w
Copy link

o-t-w commented Mar 31, 2023

IMG_5333

Yea it shipped in 16.4 but doesn’t respect user settings - as shown in this screenshot the background color is blue when I’ve changed my settings to be yellow.

@nt1m
Copy link
Member

nt1m commented Apr 26, 2023

-webkit-focus-ring-color being exposed is a mistake. AccentColor intentionally spoofs the color to protect against fingerprinting.

@lukewarlow
Copy link
Member Author

Does it make sense to close with a Concerns privacy label?

@nt1m nt1m added the concerns: privacy This proposal may cause privacy risk if implemented label Aug 22, 2023
@o-t-w
Copy link

o-t-w commented Aug 22, 2023

The fact that it isn't dynamic severely limits its usefulness.
Chromium and Firefox managed to implement it in a dynamic way. See this Twitter thread: https://twitter.com/svgeesus/status/1644364238268293122?s=20

@lukewarlow
Copy link
Member Author

Its not a technical issue, WebKit has made a conscious choice to incorrectly implement these values. In the name of "fingerprinting" protection. My opinion is just treat it as supported and if WebKit users get a worse UX then so be it. Its not vital that stuff is the right colour really.

Having said that I would agree that it should just be implemented properly.

@emilio
Copy link

emilio commented Aug 22, 2023

The fact that it isn't dynamic severely limits its usefulness. Chromium and Firefox managed to implement it in a dynamic way. See this Twitter thread: https://twitter.com/svgeesus/status/1644364238268293122?s=20

There seems to be some confusion in that thread about how visited link colors work. It's not the same situation. What UAs do is lying about :visited state, not magically changing the value of the VisitedText color. If you apply VisitedText to something not visited you'll get purple.

For context, WebKit used to return the system accent color in webkit-focus-ring-color until WebKit/WebKit@04c640b.

The way of preventing fingerprinting for system colors is just returning a fixed color like WebKit does. Firefox has code for that too, for Tor. Doing something more complex would prevent using these in things like color-mix or so on.

Returning a fixed color is a trade off that the browser can and should be able to make, and I'd rather avoid doing something weirder just for this (and have no idea how that would look like).

@clshortfuse
Copy link

  • Is there an acceptable level of entropy? Right now there's only one value. Can that be changed to something like 4, 8, or 16, by means of having presets and rounding to the near value?

  • Are there any platform decisions (eg: Added to Home Screen) where this could be reversed? I see the code for focus-ring code uses internals.setUseSystemAppearance(true) to enable this and wonder if there any other plans to adopt this. Would there be heuristics?

  • If the decision is to mask, would this affect color-mix()? For example, right now I use the HCT color designed by Google to make things look like native Android (aka: Material You colors), but even on Mac devices, trying to stick to as close to native as possible solves a lot of UX issues. But the workflow is getAccentColorViaComputedStyle() => computeHCT() => writeCSS(). I will probably move off HCT and use OKLCH() and drop all JS. If this is just meant to block JS and Canvas, then would Safari be okay with a fully CSS-based OKLCH color implementation? Or do I have to continue worry about anti-fingerprinting?

@annevk
Copy link
Contributor

annevk commented Sep 6, 2023

I think that WebKit implements these values in a way that is allowed by the specification. I guess the request is whether we want to support them in a different manner? I think as @nt1m explained we would not be comfortable with that, but I'm not sure if marking this as "position: oppose" therefore would be reasonable. That might lead to some further misunderstanding.

@clshortfuse
Copy link

clshortfuse commented Sep 6, 2023

I guess that depends on interpretation. For example, the spec says:

For systems that do not have a particular system UI concept, the specified value should be mapped to the most closely related system color value that exists

If the system, at no point displays either rgb(26, 169, 255) or rgb(0, 103, 244) (the hardcoded, anti-fingerprint blue values), then it's not following spec.

If the agent isn't able to express the system color, then I rather it doesn't. In other words, I rather detect if the agent is capable of giving me an accent system color and if not, then allow the user to select one. I rather have a grayed out option to use the system color based on CSS.Supports(), than using a fake color that has nothing to do with the system.


A mockup:

image

@lukewarlow
Copy link
Member Author

lukewarlow commented Sep 6, 2023

Yeah I think the above comment sums up my thoughts.

I would much rather it just not be implemented than be implemented and it not actually work.

If WebKit don't believe the benefits outweigh the downsides then that's their choice but I think that should be reflected with an oppose position here and preferably it not being exposed at all.

@annevk
Copy link
Contributor

annevk commented Sep 18, 2023

Given that we seem to reach different conclusions reading the same specification I opted to file w3c/csswg-drafts#9373.

I don't think it's possible however to do as you wish, at this point in time user agents are expected to support system colors and not supporting them would result in websites not working correctly.

@o-t-w
Copy link

o-t-w commented Dec 9, 2024

This resolution makes the AccentColor keyword a fair bit more useful w3c/csswg-drafts#5900 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concerns: privacy This proposal may cause privacy risk if implemented topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG
Projects
Development

No branches or pull requests

8 participants