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

cmd/go: test / tool cover: colours alone can be difficult to use for coverage, add additional indicators #27553

Closed
soumya92 opened this issue Sep 7, 2018 · 9 comments
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@soumya92
Copy link

soumya92 commented Sep 7, 2018

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/soumya/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/soumya/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build682315615=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go test -covermode=atomic -coverprofile=/tmp/coverage.out -race; and go tool cover -html=/tmp/coverage.out

What did you expect to see?

Easily distinguishable colours for covered, uncovered, and low coverage lines.

What did you see instead?

Red/green/grey, which are very hard to distinguish for quite a few people.

Possible solutions:

  • Provide the ability to specify the colours
  • Add additional indicators for coverage, maybe on the gutter or on the right side.
  • Add a few preset colour schemes (and ideally persist them somehow)
@agnivade agnivade added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FeatureRequest labels Sep 7, 2018
@agnivade agnivade added this to the Unplanned milestone Sep 7, 2018
@agnivade
Copy link
Contributor

agnivade commented Sep 7, 2018

/cc @dsymonds @robpike

@dsymonds
Copy link
Contributor

dsymonds commented Sep 7, 2018

Interesting. @robpike picked the colours specifically because they were distinguishable by people with the most common forms of colour blindness. They aren't plain red/green. Do you have a specific form of colour blindness?

Note that the HTML output has CSS classes for the elements, so you can completely customise the chosen colours with a user stylesheet.

@robpike
Copy link
Contributor

robpike commented Sep 7, 2018

I am surprised because the colors were specifically chosen by me because I am red-green colorblind. We mixed a lot of blue into the green and were careful to adjust the saturations.

@bcmills
Copy link
Contributor

bcmills commented Sep 7, 2018

(CC @katiehockman)

@katiehockman
Copy link
Contributor

From an accessibility perspective, it's generally better to not rely on color as the sole means of representing something. In this case, the hue of the green conveys how much test coverage exists for a line of code, and that's difficult to interpret in general (I personally found it a bit challenging). Even if this will work for people with a specific type of colorblindness, it is important to consider users who use modes like high contrast or grayscale. Many screen reader users will not be able to rely on color at all, so having some other option to convey the information can be helpful.
One option: there could be a "coverage percentage" number that appears at the start of each line of code, which can be toggled on/off if users want it? I could see that extra granularity of information being useful in general.

Side note: great that usability for colorblind users was considered in this design!

@soumya92
Copy link
Author

soumya92 commented Sep 7, 2018

Ah, now that it's bright again, I see that the red/green are indeed easier to distinguish. So partly this was just because it was late and my screen was very dim.

I still think that colour intensity alone is not very usable as a form of coverage indication (especially in light of the screen reader concern, but also in general I find it hard to use even now with a brighter screen).

As for user stylesheets, that's a good idea but it appears that Chrome only supports user stylesheets via an extension that by design requires very invasive permissions, so maybe a way to just add arbitrary content to generated coverage reports would still be useful.

Thanks for taking a look!

@soumya92 soumya92 changed the title cmd/go: test / tool cover: colours are not accessible with red-green colour blindness cmd/go: test / tool cover: colours alone can be difficult to use for coverage, add additional indicators Sep 7, 2018
@soumya92
Copy link
Author

soumya92 commented Sep 7, 2018

Heh, this is embarrassing. Apparently I had a blue-light filter running 😳.
So the colour choice itself seems perfectly fine.

@ianlancetaylor
Copy link
Contributor

Thanks for following up.

@robpike
Copy link
Contributor

robpike commented Sep 8, 2018

Happy!

@golang golang locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

8 participants