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

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

I am, yes. I think if you want more information than just `accent-color`, some combination of `color` and `color-scheme`  and maybe also `background-color` (of either the element or the canvas) should give enough information to do something that coordinates with the page. The use of colors varies a lot in form controls (across controls, across platforms, and across time), checkboxes being one of the simplest and most consistent. We _know_ we're not going to be able to ask the author for a full, exact palette for every control, so we need to accept that the author can only give us hints rather than instructions here.

There's some cases where contrast will require a light color or a dark color, but in the middle zone there's a lot of leeway. Which way to bias might want to take into consideration the `color-scheme` (as you've done in the updated Chrome patch) but also things like “is the checkmark in our design system intended to coordinate with the background color or the foreground color of the theme” which is going to vary based on UA- and platform-specific design choices. So we can't dictate that in the spec.

The only thing we're going to dictate, is that the UA does its best to ensure some reasonable level of legibility. (It doesn't have to _maximize_ contrast.)

As for pages that use tinted foregrounds/background colors, you can check `color` and/or `background-color` to see if either creates enough contrast to use in place of the system default colors. A page with dark brown text, a tan background, and light green accent-color for example, might want dark brown or tan checkmarks instead of black or white ones.

Remember the point of `accent-color` isn't to give 100% control over the checkboxes to the author. It's to let them influence the colors of the form control scheme designed by the UA. In other words, its parameterizing the design logic that led to the default colors, not dictating the final colors.


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


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

Received on Friday, 18 June 2021 21:36:10 UTC