Skip to content

[css-ui-4] Transparent accent colors #9852

@frivoal

Description

@frivoal

What does it mean for an accent color to be wholly or partly transparent?

This example shows a series of ratio buttons with black, dark blue, light blue, white, fully transparent, highly transparent dark blue, and slighly transparent dark blue, over a light background, then a dark one.
http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=12308

Chrome:
Screenshot 2024-01-25 at 13 42 57

Safari:
Screenshot 2024-01-25 at 13 43 30

Firefox:
Screenshot 2024-01-25 at 13 44 13

In all cases, the accent color is taken into account, and in all cases, reasonable contrast is ensured. So the spec is respected, and this may be all we need.

But I do notice that browsers process the transparency differently:
Chrome and Safari ignore the alpha channel entirely, while Firefox seems to precompose it over white, and use the resulting color as the accent. Note that none of them actually make the accented control transparent (which seems like a good idea in order to manage contrast).

This can result in an accent that is of a visually very different color:

  • The 5th radio button (transparent) in Firefox is white (because transparent over white gives white), while it's black in Chrome and Safari (because the transparent keyword means transparent black and we're ignoring the alpha channel).
  • The 6th button (highly transparent dark blue) in Firefox is light blue, while it's dark blue in Chrome and Safari.

Do we consider this level of variation appropriate to enable differentiation, or should we mandate a particular approach to handling transparency so that authors get more predictable colors?

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Tuesday morning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions