Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Test coverage highlight colors are not colorblind friendly #1302

Closed
dcormier opened this issue Oct 23, 2017 · 13 comments
Closed

Test coverage highlight colors are not colorblind friendly #1302

dcormier opened this issue Oct 23, 2017 · 13 comments
Milestone

Comments

@dcormier
Copy link

The red/green test coverage highlight colors are not colorblind friendly, and there does not appear to be a way to configure the highlight color (if there is a way, please do correct me).

I'm colorblind (as are ~10% of people with XY chromosomes), and it's hard for me to use the colors tell what's been covered and what has not.

@dcormier dcormier changed the title Test coverage highlight color are not colorblind friendly Test coverage highlight colors are not colorblind friendly Oct 24, 2017
@sigwinch28
Copy link

Same issue here. I have a red/green colour deficiency and I struggle to tell the reds and greens apart.

It appears that the gutter coverage (which I use) is implemented via images/gutter-green.svg and images/gutter-red.svg. So it looks like this is hard-coded.

Would it not be possible to generate these SVGs in memory according to a user's colour preferences?

@sigwinch28
Copy link

sigwinch28 commented Oct 30, 2017

I have a temporary workaround for gutter coverage: replace the colour code in gutter-green.svg (or gutter-red.svg) in your .vscode/extensions/lukehoban.go-x.x.x/images directory to your liking:

<svg width="32" height="48" viewPort="0 0 32 48"
    xmlns="http://www.w3.org/2000/svg">
  <!-- <polygon points="16,0 32,0 32,48 16,48" fill="#A6DC8E"/> -->
  <polygon points="16,0 32,0 32,48 16,48" fill="#5C8BA9"/>
</svg>

@ramya-rao-a
Copy link
Contributor

@sigwinch28 The api for applying decorator on the gutter takes absolute path to the svg file, so generating them during runtime is not possible.

How about using a pattern in the svg instead to denote either covered or uncovered areas?

@ramya-rao-a
Copy link
Contributor

Also, we have a setting to highlight only the covered areas or only the uncovered areas.

image

If you set the setting go.coverageOptions to either showCoveredCodeOnly or showUncoveredCodeOnly, then you dont have to try and differentiate the 2 colors. The gutter or the highlight will appear only for either covered or uncovered areas.

Does that help?

@sigwinch28
Copy link

@ramya-rao-a That definitely helps for me.

Alas, would it be possible to distribute a handful of SVGs as part of two or three colour schemes, too?

@ramya-rao-a
Copy link
Contributor

@sigwinch28 Yes it is very much possible to use different sets of svgs based on color schemes, I just don't know what colors to use :)

If you can help me with which colors make sense, then we can have a setting to choose the color scheme for the coverage

@sigwinch28
Copy link

sigwinch28 commented Nov 11, 2017

According to a post on the UX stack exchange and the article it cites, it looks like yellow/blue should be a good combination (see this example palette).

Here's a bit more on the subject: http://jfly.iam.u-tokyo.ac.jp/color/#pallet

I chose the yellow for uncovered and blue for covered:

image

Edit: @ramya-rao-a as you suggested, a pattern could work, too. Perhaps some diagonal striping in one of the decorations?

@Mistobaan
Copy link

Same issue here but for the color highlighting itself. I am using the solarmode and the red totally obscures the text.

Can we make the colors configurables?

https://github.com/Microsoft/vscode-go/blob/cded61c853da3e4a9cfa06dbfca818da6d79ee80/src/goCover.ts#L19

@ramya-rao-a
Copy link
Contributor

@Mistobaan Sure that's a good suggestion

We have the setting go.coverageDecorator for which valid values are either gutter or highlight. We can extend this and make it accept an object as well. For eg:

"go.coverageDecorator": {
    "type": "highlight",
    "coveredColor": "rgba(64,128,64,0.5)",
    "uncoveredColor": "rgba(128,64,64,0.5)"
}

PRs are welcome

@kentquirk
Copy link
Contributor

@ramya-rao-a -- I have started working on this, but I need some guidance, please. Here you indicate using the coverageDecorator setting as an object, which is totally possible -- but the problem is that if we do it this way, then the settings editor can't provide editing help (as it does with enums, for example). I have a design which adds several settings (for color of both highlight and gutter decorators, as well as the appearance in the gutter), each of which has a type and therefore could be easy to edit. But in #1649, you say "we already have way too many settings".

I personally think that extra settings are OK as long as the defaults are good, but if you feel strongly enough to reject a PR with new settings, then I will do it as an object on coverageDecorator instead (as noted above) and then people will have to edit it manually.

The third alternative is to leave it as non-settable but just change the colors to blue/yellow, and also change the gutter appearance.

Please tell me which of these you prefer and I can make it happen this week.

@kentquirk
Copy link
Contributor

kentquirk commented May 27, 2018

After thinking about it, I decided to go with the single modification to go.coverageDecorator, so it creates no new settings. The setting is now an object instead of a string, but if a string is left in the settings from a previous setup, it still works properly.

The setting now looks like:

    "go.coverageDecorator": {
        "type": "highlight",
        "isWholeLine": false,
        "coveredHighlightColor": "rgba(64,128,128,0.5)",
        "uncoveredHighlightColor": "rgba(128,64,64,0.25)",
        "coveredGutterStyle": "blockblue",
        "uncoveredGutterStyle": "slashyellow"
    }

The PR is up as #1695.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jun 1, 2018

Thanks to @kentquirk, this feature is now in.

To give it a spin before I release an update,

Then play with the go.coverageDecorator setting to tweak as needed.

@kentquirk I have updated your comment above to include the new names for the colors for the covered/uncovered highlights

@dcormier @sigwinch28 Please give this a try and let me know which gutter styles work the best.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jun 4, 2018

This feature is now out in the latest update to the Go extension (0.6.81)

@ramya-rao-a ramya-rao-a added this to the 0.6.81 milestone Jun 4, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants