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(color-contrast): allow small text shadows to serve as text outline #2627

Merged
merged 5 commits into from
Nov 9, 2020

Conversation

WilcoFiers
Copy link
Contributor

@WilcoFiers WilcoFiers commented Nov 7, 2020

Closes issue: #2541

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Code is reviewed for security

@WilcoFiers WilcoFiers marked this pull request as ready for review November 9, 2020 10:14
@WilcoFiers WilcoFiers requested a review from a team as a code owner November 9, 2020 10:14
@WilcoFiers WilcoFiers changed the title fix: allow small text shadows to contrast on either side fix(color-contrast): allow small text shadows to serve as an outline Nov 9, 2020
Comment on lines -95 to +118
return 3.7 / (blurRadius + 8);
const relativeBlur = blurRadius / fontSize;
return 0.185 / (relativeBlur + 0.4);
Copy link
Contributor Author

@WilcoFiers WilcoFiers Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In working through this I realised these numbers should be relative to the font-size. I used a 20px font when I got these numbers, so I divided the numbers by 20. Block 9 in the text-shadow integration tests handle this.

Comment on lines 532 to 540
/*
False positives:
- b5-r3-i1, b5-r3-i2
- b7-r3-i1, b7-r3-i2

False negatives:
- b3-r1-i1
- b4-r1-i1, b4-r2-i1
- b8-r1-i1, b8-r5-i1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left this here just to have a record of it. All these test cases are on the edge of pass and fail. If we ever revisit them, these are the ones I think could be improved on, but I suspect I've put enough time into this it'll never come up.

Copy link
Contributor

@straker straker Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this comment in the code? Otherwise in a month or two we won't remember what the comment in the code means (there's no context).

@WilcoFiers WilcoFiers changed the title fix(color-contrast): allow small text shadows to serve as an outline fix(color-contrast): allow small text shadows to serve as text outline Nov 9, 2020
straker
straker previously requested changes Nov 9, 2020
doc/check-options.md Outdated Show resolved Hide resolved
WilcoFiers and others added 2 commits November 9, 2020 17:18
Co-authored-by: Steven Lambert <2433219+straker@users.noreply.github.com>
@WilcoFiers WilcoFiers merged commit 432e1f3 into develop Nov 9, 2020
@WilcoFiers WilcoFiers deleted the shadow-contrast branch November 9, 2020 18:16
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