Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color-contrast does not take into account mix-blend-mode #3187

Open
straker opened this issue Oct 5, 2021 · 1 comment
Open

Color-contrast does not take into account mix-blend-mode #3187

straker opened this issue Oct 5, 2021 · 1 comment
Assignees
Labels
color contrast Color contrast issues

Comments

@straker
Copy link
Contributor

straker commented Oct 5, 2021

The mix-blend-mode CSS property specifies how colors are blended together. By default the mix-blend-mode is set to normal, which is mostly how our flattenColor algorithm works. But by changing the mix-blend-mode the background color can be completely different.

For example, taking this HTML, the output is faint green color.

<div style="background-color: rgba(255, 255, 255, 1.0);">
  <div style="background-color: rgba(0, 128, 0, 0.25);">Hello World</div>
</div>

image

But if we change the blend mode we get a completely different color, in this case a faint pink color.

<div style="background-color: rgba(255, 255, 255, 1.0);">
  <div style="background-color: rgba(0, 128, 0, 0.25);mix-blend-mode: exclusion;">Hello World</div>
</div>

image

See https://www.w3.org/TR/compositing-1/#blending

@straker straker added the color contrast Color contrast issues label Oct 5, 2021
@Zidious Zidious self-assigned this Oct 20, 2021
@Zidious
Copy link
Contributor

Zidious commented Oct 20, 2021

Note: mix blend mode also needs to take into account text colour when blending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color contrast Color contrast issues
Projects
None yet
Development

No branches or pull requests

2 participants