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

feat(color-contrast, utils): add more options to color-contrast, add utils.deepMerge, deprecate commons.color.hasValidContrastRatio #2256

Merged
merged 11 commits into from
Jul 8, 2020

Conversation

straker
Copy link
Contributor

@straker straker commented May 28, 2020

We needed to have options to specify the minimum contrast the check should apply to allow rules a specific range of contrast to determine pass/fail.

Closes issue: #2175

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

@straker straker requested a review from a team as a code owner May 28, 2020 22:23
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Put in a suggestion, let me know what you think.

lib/checks/color/color-contrast.json Outdated Show resolved Hide resolved
@straker
Copy link
Contributor Author

straker commented Jul 1, 2020

With nested options, the check.getOptions merge wasn't working as Object.assgin does not do a deep merge (as mentioned in #2315). Since I needed another deep merge of objects I decided to move it to a utility function.

@straker straker changed the title feat(color-contrast): add options for bold size, font size, and contrast ratio requirements feat(color-contrast, utils): add options for bold size, font size, and contrast ratio requirements, add utils.deepMerge, deprecate commons.color.hasValidContrastRatio Jul 1, 2020
@straker straker changed the title feat(color-contrast, utils): add options for bold size, font size, and contrast ratio requirements, add utils.deepMerge, deprecate commons.color.hasValidContrastRatio feat(color-contrast, utils): add more options to color-contrast, add utils.deepMerge, deprecate commons.color.hasValidContrastRatio Jul 1, 2020
"normal": {
"expected": 4.5,
"minThreshold": 0,
"maxThreshold": 999
Copy link
Contributor Author

@straker straker Jul 2, 2020

Choose a reason for hiding this comment

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

This number is arbitrary. It just needed to be something larger than the contrast ratio could ever go (#fff vs #000 = 21:1)

lib/checks/color/color-contrast.json Outdated Show resolved Hide resolved
lib/checks/color/color-contrast-evaluate.js Outdated Show resolved Hide resolved
lib/checks/color/color-contrast-evaluate.js Outdated Show resolved Hide resolved
lib/checks/color/color-contrast.json Outdated Show resolved Hide resolved
lib/checks/color/color-contrast.json Outdated Show resolved Hide resolved
lib/checks/color/color-contrast-evaluate.js Outdated Show resolved Hide resolved
straker and others added 7 commits July 6, 2020 08:11
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
lib/checks/color/color-contrast.json Outdated Show resolved Hide resolved
@straker straker merged commit 49fdb46 into develop Jul 8, 2020
@straker straker deleted the color-contrast-options branch July 8, 2020 14:52
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.

None yet

2 participants