GTXiLib icon indicating copy to clipboard operation
GTXiLib copied to clipboard

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

Open nanwng opened this issue 6 years ago • 3 comments

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

nanwng avatar Apr 17 '19 21:04 nanwng

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.

j-sid avatar Apr 18 '19 19:04 j-sid

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 avatar Apr 18 '19 20:04 nanwng

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

nanwng avatar Apr 22 '19 18:04 nanwng