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

docs: increase syntax highlighting color contrast #5681

Merged
merged 1 commit into from
Nov 16, 2020

Conversation

geoffrich
Copy link
Member

This partially resolves one of the Axe Accessibility violations listed in #5678: Elements must have sufficient color contrast (2018 count).

This reduces the number of color contrast violations from 2018 to 228. The colors for the syntax highlighting tokens were below the WCAG AA threshold of 4.5. This meant that people with low vision could have difficulty reading the text. Below is a list of contrast ratios for each token, before and after the change.

  • base: was 4.26, now 7.21
  • comment: was 2.8, now 5.23
  • keyword: was 4.1, now 4.54
  • function: was 4.31, now 4.5
  • string: was 3.49, now 4.65
  • number: was 2.84, now 4.89

Before:
image

After:
image

I adapted some of the colors from Eric Bailey's accessible syntax highlighting themes.

@benmccann
Copy link
Member

It would help get this reviewed to include a screenshot of the changes

@benmccann benmccann added the site label Nov 16, 2020
@geoffrich
Copy link
Member Author

It would help get this reviewed to include a screenshot of the changes

I put a before/after image of one of the syntax highlighted code blocks that shows the changes -- was there something else you wanted a screenshot of?

In the image, you can see that (for instance) the text color of the comments in the "after" image is darker than the text color in the "before" image.

@benmccann
Copy link
Member

Oh, I didn't look that closely and didn't realize that you were changing the colors for code blocks. Sorry for the confusion 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants