Theme-ui: Most Prism presets are failing a11y color contrast checks

Created on 12 Jan 2020  路  5Comments  路  Source: system-ui/theme-ui

Describe the bug

Many of the prism themes are failing the color contrast checks that are run by cypress-axe. Many of the themes are close or are meeting "AA Large" but because of the font size the contrast needs to be a minimum of "AA".

So far I have checked (and fixed, see https://github.com/system-ui/theme-ui/pull/565):

  • Dracula (failed)
  • Duotone Dark (failed)
  • Duotone Light (failed)
  • Github (failed)
  • Night Owl (failed)
  • Night Owl Light (failed)
  • Oceanic Next (passed)

To Reproduce

Run a11y checks on a site using Theme-UI and prism presets.

Expected behavior

Pass all a11y checks.

Screenshots

N/A

Additional context

N/A

help wanted

All 5 comments

Thanks for bringing this up! These color schemes are generated from the upstream react-prism-renderer library, so this could get overridden in the future. It might be worth bringing this to the attention of the maintainers of that library

This definitely isn鈥檛 an amazing ending, but it seems like we have three choices:

  1. Wait for upstream libraries to improve this
  2. Fork/provide our own themes
  3. Let users handle this themselves

It seems like we鈥檙e doing 3 with the hopes of 1 for now. Leave it at that or do we want to solve this ourselves?

I don't think we should wait on 1 based on the comments in the other issue :/

I think we should fork the existing ones, make them have sufficient color contrast, and promote the forked more accessible ones in the docs. We can still provide the official ones in code, but I don't think we should promote them in docs.

My original PR up above had some fixed versions. It was pretty simple to just use your Colorable tool and tweak the contrast until it met cutoffs. That PR could be reopened and worked on.

There is also this which I found, but haven't looked into:

https://openbase.io/js/a11y-syntax-highlighting

This is absolutely something that should be better, but I don鈥檛 think we should try to solve it in this project since these colorschemes are all from other packages. We鈥檙e going to close this issue & wait for the upstream libraries to update their colors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ekafyi picture ekafyi  路  4Comments

vojtaholik picture vojtaholik  路  3Comments

tesseralis picture tesseralis  路  3Comments

LeunensMichiel picture LeunensMichiel  路  3Comments

george-norris-salesforce picture george-norris-salesforce  路  3Comments