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

josepharhar has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-ui-4] choosing background colors for accent-color for contrast ==
[accent-color](https://www.w3.org/TR/css-ui-4/#widget-accent) allows the page to specify a color to be drawn sort of in the foreground of several form controls, but does not specify anything about what color the browser should draw the rest of the form control with.

When I was implementing this in chromium, I realized that I needed to draw the rest of the background of the form control in a color that had enough contrast to the accent-color in order to make it easy to see the accent-colored parts.
I made a basic solution to this in chromium by looking at the ["relative luminance"](https://source.chromium.org/chromium/chromium/src/+/master:ui/gfx/color_utils.cc;l=83-87;drc=ec0fe0e6c1d5827f109e6e7f9ee49155ef1e38f7) of the accent-color and using that to decide if the accent-color was light or dark, and then drawing the rest of the control as if it were in color-scheme:light or color-scheme:dark based on that.

Should any of this behavior be specified? Should there be any guidance on how to color the rest of the form control in response to the accent-color? Does anyone have any feelings about the current implementation which you can try out in chrome canary, such as tweaking the point where it switches from light to dark or finding some way to make it have a range of background colors instead of just two?

Some more context here: https://bugs.chromium.org/p/chromium/issues/detail?id=1189332
Example site for testing: https://css-accent-color.glitch.me/

cc @mfreed7 @fantasai @argyleink 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6159 using your GitHub account


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

Received on Monday, 29 March 2021 23:43:51 UTC