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

WPT pass/fail pie charts have low contrast, exacerbate red-green anomalouus color vision #2340

Open
svgeesus opened this issue Sep 4, 2022 · 9 comments
Labels

Comments

@svgeesus
Copy link
Contributor

svgeesus commented Sep 4, 2022

Originally reported as an issue on CSS Color 5,

but not specific to that specification.

image

@svgeesus
Copy link
Contributor Author

svgeesus commented Sep 4, 2022

The generated html for one pie chart is

<span title="firefox 9/29" class="wpt-result" 
style="background: conic-gradient(forestgreen 111.72413793103449deg, darkred 0deg);"></span>

@svgeesus
Copy link
Contributor Author

svgeesus commented Sep 4, 2022

@matatk

@matatk
Copy link

matatk commented Sep 5, 2022

Re-posting the suggestion from the original issue, for convenience:

Suggestion: use techniques similar to those from Figure 21 in the Understanding WCAG SC 1.4.11 document, i.e. (1) separating the segments; (2) using more contrasting colours; and/or (3) using hollow and solid segments to ease differentiation.

Please ping me if you have any questions.

Update: just adding this link to close the loop back to the a11y-request issue: This comment is from the APA WG and relates to our review of CSS Color Module Level 5.

@tabatkins
Copy link
Collaborator

Hm, I chose the colors to have differentiable color brightnesses, without being excessive and causing color vibration. (I have a minor amount of red/green anomaly, and they look good to me now, but didn't when I was using CSS red and green.)

Happy to do something different, tho I'm currently just doing a conic-gradient() so anything beyond just changing the colors will require some more effort to make happen.

@svgeesus
Copy link
Contributor Author

svgeesus commented Sep 8, 2022

forestgreen is oklch(55.78% 0.1688 142.89) while darkred is oklch(39.986% 0.1641 29.234) so a Lightness difference of 15.

@tabatkins
Copy link
Collaborator

tabatkins commented Sep 8, 2022 via email

@matatk
Copy link

matatk commented Oct 9, 2022

Thanks @tabatkins, @svgeesus. Using the WCAG contrast ratio calculation, forestgreen and darkred have a ratio of 2.28:1. For adjacent non-text items that impart meaning, WCAG requires at least 3:1.

In the enlarged picture above, the colours seem much further apart to me than they did in the spec itself, but the small size of the charts on the page exacerbates the issue (for me, personally, at least). I acknowledge that there's work afoot on alternative contrast ratio algorithms—though I feel that some people will struggle to differentiate the parts of these charts. (I have a vision impairment; I'm actually very good with color, but find this difference somewhat low—though I am doing my best to talk from professional, rather than personal, experience.)

I have had another closer look at the screengrab above, and the spec on my screen, and the colours seem different (my green is more vibrant; the one above seems washed out), so there could be a colour profile issue exacerbating my perception of this (though, again, this is likely to be hard for some others to distinguish, too).

I can understand you may be concerned that if you were to meet a 3:1 ratio here, the colours would be somewhat distorted. Perhaps it would help to try separating out the slices of pie (though ACK regarding the CSS technique you're using being neat and concise). I also wondered about having a 'solid' section and a 'hollow' section for the chart.

@svgeesus
Copy link
Contributor Author

I have had another closer look at the screengrab above, and the spec on my screen, and the colours seem different (my green is more vibrant; the one above seems washed out), so there could be a colour profile issue exacerbating my perception of this

It is a color profile issue, but on my end: Windows grabs the rgb values from the frame buffer but does not link these to the ICC profile of the screen. Since they are untagged, they get treated as sRGB values but here, they are the values on my wide gamut screen. So the grab looks washed out.

@svgeesus
Copy link
Contributor Author

svgeesus commented Oct 11, 2022

Agreed the WCAG 2.1 contrast is 2.28 while the APCA Lc is 18.8 if green is the text color, -19 if the red is the text color.

Changing forestgreen to lightgreen ups WCAG 2.1 to 7.06 and APCA Lc to 68.5 or -71 depending which is considered text.

@jyasskin jyasskin added the bug label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants