Re: [csswg-drafts] [css-ui-4] choosing background colors for accent-color for contrast (#6159)

I recently [updated the behavior](https://chromium-review.googlesource.com/c/chromium/src/+/2907972) in chrome to determine when the color-scheme gets flipped to look at the contrast ratio of the adjacent color used when painting each control. However, in the interest of interop, maybe it would be better if we decided on something else...

> We've got #5544 open on providing multiple alternative accent colors to be chosen by optimizing contrast. But I don't think we need to force the author to give more than one.

I skimmed the issue and it's a bit mind boggling for me to figure it all out, but since we aren't forcing the author to give more than one, I'm going to focus on making this work with the single option case.

> So I'm pretty sure that it'd be better if we allowed authors to provide a "foreground" color of sorts. I also think that we don't want to auto-switch to dark-mode form controls, which is different from that IMO.

@tabatkins and @fantasai seem to be against providing multiple colors for foreground and background based on their previous comments in this thread...?

> Happy to provide more non-normative guidance, so engineers don't have to reinvent the wheel here on their own. Basing it on relative luminance sounds completely reasonable, tho I'd want to do some testing to see how it responds in practice.

> Agree with Tab that we can add non-normative suggestions e.g. on what math to use to calculate or adjust contrast, but I would be against adding any kind of normative rules: this is an area where UAs should be allowed to freely experiment.

@tabatkins @fantasai could I get some suggestions on what to do with the rest of the control in response to the accent-color? Do you think that flipping the color-scheme is a good idea or a bad idea? Are there any alternatives? Is my current contrast ratio check of 3 too aggressive? Should I change it back to a luminance check?

> i dont think it's intuitive to tell someone: "you can use your brand color as form control accent colors now! but, beware, the color you choose may flip the controls to a light or dark theme." seems obvious i have a new responsibility once i start styling form controls different then their defaults?

Another way I could see this playing out is where authors (must?) write two accent-color rules based on the color scheme like this:
```css
@media (prefers-color-scheme: dark) {
  input {
    accent-color: lightblue;
  }
}
@media (prefers-color-scheme: light) {
  input {
    accent-color: darkblue;
  }
}
```

-- 
GitHub Notification of comment by josepharhar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6159#issuecomment-858086593 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 9 June 2021 20:43:13 UTC