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

A11y: adjust colour contrast for dark theme #5599

Closed
4 tasks done
hugovk opened this issue Jun 11, 2023 · 5 comments
Closed
4 tasks done

A11y: adjust colour contrast for dark theme #5599

hugovk opened this issue Jun 11, 2023 · 5 comments
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open

Comments

@hugovk
Copy link

hugovk commented Jun 11, 2023

Context

No response

Bug description

With the dark theme, pages such as:

don't have enough contrast for the links, making them hard to read and affecting accessibility.

The ratio doesn't meet the WCAG guidelines.

Related links

Reproduction

example.zip

Steps to reproduce

  1. Open site in dark mode
  2. Inspect page in Chrome, select Lighthouse tab
  3. Select Accessibility category (can uncheck others to speed it up)
  4. Click "Analyze page load"
  5. Check results

Expected results:

Score: 100 and no contrast issues

Actual results:

Several contrast issues found:

Details image image

In my view, the top priority would be to fix the colour used for links (var(--md-typeset-a-color)) which especially problematic for pages like https://blog.pypi.org/

Suggestion:

Inspect the problematic text using Chrome:

Details image

Click the colour square in the styles pane and expand the bit next to Contrast ratio:

Details image

Click the box next to AA 4.5 to get a suggested colour:

Details image

This gives #7299e1 which is a good replacement for the problematic #6c91d5.

Note: make sure not to change colours for light mode at the same time, or it may make the contrast worse for light mode.

Browser

Chrome

Before submitting

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Jun 12, 2023
@squidfunk
Copy link
Owner

Thanks for reporting. I agree that we can improve link colors in the theme-provided colors.

However, for PyPI, the story is different. It seems that they customized the theme, and changed the primary color to their CI colors, but didn't adjust some other colors to fit dark mode.

Thus, I would recommend to raise this problem to the maintainers of the PyPI blog.

@hugovk
Copy link
Author

hugovk commented Jun 20, 2023

Aha, thanks for pointing that out, I've opened pypi/warehouse#13972 to fix the main PyPI contrast problem.

@squidfunk
Copy link
Owner

Thanks again for the report and the directions to fix the issue. Applied your suggested changes in a4babcf. They will be released with 9.2.0b3 and subsequently the stable release.

@squidfunk squidfunk added change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels Aug 1, 2023
@hugovk
Copy link
Author

hugovk commented Aug 1, 2023

Thank you!

@squidfunk
Copy link
Owner

Released as part of 9.2.0b3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants