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

Prevent accidental contrast degradations for styles via test #3390

Closed
wants to merge 3 commits into from
Closed

Prevent accidental contrast degradations for styles via test #3390

wants to merge 3 commits into from

Commits on Nov 4, 2021

  1. change styles to use hex colors

    Preparation commit for the style contrast test.
    Changing all colors to hex colors in the form of
    either #000 or #000000 makes them easy to parse.
    not-my-profile committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    d6795a9 View commit details
    Browse the repository at this point in the history
  2. change styles so that 1st CSS rule has default colors

    Preparation commit for the style contrast test.
    If styles always contain the .hljs { } as the first rule with both color
    and background, this greatly simplifies parsing the CSS file for the
    contrast test.
    not-my-profile committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    dcf3659 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2021

  1. prevent accidental contrast degradations via test

    This commit introduces a test that asserts that the minimum WCAG
    contrast ratio of a style is specified in
    ./test/contrast/min_contrasts.json.
    
    When a contrast is decreased the test fails with, e.g:
    
      Error: minimum contrast decreased for style default.css (2.4 < 3.4)
      if this is intentional please run tools/updateContrasts.js -f
    
    When you improve a minimum contrast the test fails with:
    
      Error: congrats, you improved the minimum contrast of default.css, please run tools/updateContrasts.js
    
    In both cases running the script as instructed updates the JSON file,
    making the test pass.
    not-my-profile committed Nov 5, 2021
    Configuration menu
    Copy the full SHA
    32014df View commit details
    Browse the repository at this point in the history