w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.51k stars 669 forks source link

[css-ui] Make `accent-color` accept foreground and background value #11180

Open Crissov opened 5 days ago

Crissov commented 5 days ago

https://drafts.csswg.org/css-ui-4/#propdef-accent-color

Arguably, color should have been a shorthand property to set two longhand properites, i.e. background-color and a hypothetic text-color or foreground-color (reflected in the currentcolor dynamic value, related to fill-color and stroke-color). I thought this was recorded in the list of mistakes but it is not.

Can we make accent-color accept a second, optional <color> value to override both, AccentColor (mostly background) and AccentColorText (foreground), from System Colors? Not being able to set both may lead to insufficient contrast for UA-defined accent text on a author-defined accent background.

PS: Original issue was #5900, see its resolution:

AccentColor takes its value from accent-color, and AccentColorText takes its value from the appropriately contrasting foreground color for AccentColor;

bleper commented 5 days ago

Note: text-color and foreground-color already the thing. And there is no progress on the similar proposal to add a keyword in #5292 (if the spec changes currentcolor it won't be very web compatible), instead inherit() will cover this possibility.