pa11y / pa11y-ci

Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
https://pa11y.org
GNU Lesser General Public License v3.0
519 stars 63 forks source link

Changing ANSI Colors in pa11y-ci output #108

Open mike-potter opened 4 years ago

mike-potter commented 4 years ago

When running pa11y-ci locally in a terminal window with color enabled, the actual error messages are impossible to read if using a black background in Terminal (which is a common "dark mode" config these days)

For example:

• Anchor element found with a valid href attribute, but no link content has been supplied.

   (html > body > footer > nav > div > section:nth-child(4) > section:nth-child(1) >
   span:nth-child(2) > a)

   <a href="https://www.linkedin.com/company"> <div class="fill-current s...</a>

Has the first line with the in white, but has the error for the html in a very dark gray color.

A bit ironic that the output of pa11y-ci itself isn't accessible ;)

I know you can't account for possible different terminal output color schemes, so mainly asking for either a "dark" scheme that just changes this dark-gray to a very light-grey, or a --no-color flag itself or something.

Right now I'm resorting to a script that changes my terminal settings before running pa11y then restoring them afterwards.

Forgive me if there is already some option for this, but couldn't find anything in searching or docs. Thanks!

josebolos commented 2 years ago

Hi @mike-potter

Thanks for creating this issue. Would it be possible to share the name of the colour scheme that you use in your terminal and/or a screenshot of the problem? Most of us use terminals with dark colour schemes and we haven't encountered this problem, it's definitely something that we would have addressed earlier if we had experienced it.

Regarding disabling colour output altogether, as most unix tools pa11y-ci uses a library to output colour that will detect it the tool is run on non-TTY contexts and disable colour output accordingly. So for example piping pa11y-ci's output through a command like cat will cause colour to be disabled automatically:

pa11y-ci 'https://www.example.com/' | cat