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

Fix calculation of foreground colours. #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

colons
Copy link
Contributor

@colons colons commented Apr 16, 2019

This should fix #16.

There were a few things wrong here; firstly, the color of foreground text is not based on stacking all parent color attributes; it's based on stacking the single most specific color on top of all previous
backgrounds.

Secontly, int(0.9) is zero, so all semitransparency was being ignored.

There were a few things wrong here; firstly, the `color` of foreground
text is not based on stacking all parent `color` attributes; it's based
on stacking the single most specific `color` on top of all previous
backgrounds.

Secontly, int(0.9) is zero, so all semitransparency was being ignored.
@colons
Copy link
Contributor Author

colons commented Apr 16, 2019

…on further inspection, this does not fix the issue; despite modifying the maths as little as possible, it seems like the alpha channel is being interpreted backwards; I'm going to investigate this some more, and would encourage not merging this for the moment.

colons added 2 commits April 17, 2019 11:06
This, in particular, fixes an issue where the 'span' in this html would
be considered to have a color of solid black:

<!doctype html>
<html>
  <head>
    <title>wcag zoo contrast testing</title>
    <style>
      span {
        color: rgb(0, 0, 0);
      }

      div {
        background-color: rgb(0, 0, 0);
        color: rgb(255, 255, 255);
      }

      p span {
        color: inherit;
      }
    </style>
  </head>
  <body>
    <div>
      <p><span>woof</span></p>
    </div>
  </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Molerat is confused by transparency in nested elements
1 participant