Skip to content

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