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

The color contrast check should use the most contrasting pixel instead of the average #11

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

Conversation

nanwng
Copy link

@nanwng nanwng commented Apr 17, 2019

The current behavior to average foreground color to check for contrast seems wrong.

  • correct behavior is to determine most contrasting pixel value
  • fix is to find foreground darkest and lightest pixel and compute ratio w/ background, then take the larger ratio value

@j-sid
Copy link
Collaborator

j-sid commented Apr 18, 2019

Hi Nan, thanks for the PR.
A couple of comments: taking the most contrasting pixel values has its own disadvantages since most contrasting pixels may be fewer in number (especially when text is anti aliased), I suggest creating a new contrast check that uses your algorithm leaving the existing check as is.

@nanwng
Copy link
Author

nanwng commented Apr 18, 2019

Hi Nan, thanks for the PR.
A couple of comments: taking the most contrasting pixel values has its own disadvantages since most contrasting pixels may be fewer in number (especially when text is anti aliased), I suggest creating a new contrast check that uses your algorithm leaving the existing check as is.

Thanks for your response. I'll update it with a new rule.

@nanwng
Copy link
Author

nanwng commented Apr 22, 2019

@j-sid Can you take another look? Thanks!

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.

2 participants