-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Slightly increase contrast for footer text to meet WCAG guidelines #4823
Comments
Thanks for suggesting and digging into possible solutions. For the footer colors, we already deviate from the standard color definitions as defined via the Fixed in 38e2914. |
Released as part of 9.0.2. |
Thanks for addressing this so quickly! |
@squidfunk Did you do any accessibility testing with the color change? The value I suggested above was a guess due to not being familiar with how you're setting colors - and from preliminary testing with 9.0.2, it looks like I didn't guess high enough. The contrast is better, but still doesn't meet guidelines. |
No, I didn't, I trusted your inputs, but I just re-read your original post and now see that you weren't sure. Reopening, looking into it again. |
Unfortunately I'm not a web dev and am still very much learning this topic. Apologies for not putting more focus on the fact that the value was a guess, I could have bolded or similar and did not. Thank you for reopening and being willing to take a second look. |
If you absolutely must have 4.5 for color contrast, you are going to target an alpha around 0.45. Rounding off the contrast gives you 4.5. >>> bg = Color('#16171d')
>>> fg = Color('hsla(0, 0%, 100%, 0.45)').convert('srgb').compose(bg)
>>> fg.to_string(hex=True)
#7f7f83
>>> bg.to_string(hex=True)
#16171d
>>> fg.contrast(bg)
4.49813259779425 You can play with the results here: |
Also, keep in mind that the WCAG 2.1 contrast is flawed to some extent. That is why work for WCAG 3 is targeting a different way to calculate contrast. I think they are considering this for 3: https://github.com/Myndex/apca-w3. No decisions are final though. Just an FYI. |
Also, the above is just calculating color contrast, it does not take into consideration text size and such. |
Turtles all the way down 😁 Thanks for the pointers @facelessuser, I'll take a look! And no worries @lee0c, I could have read your issue better, so it's essentially my fault. |
I've checked, and using |
Yeah, I forgot to print out the non-alpha blended value. You are correct, that does in fact equal >>> Color('hsla(0, 0%, 100%, 0.45)').convert('srgb').to_string(hex=True)
#ffffff73 Anyways, that should be close enough 🙂. |
Thank you to both of you, especially for the extra info @facelessuser ! You're totally right that the contrast isn't a perfect fix and I am glad to hear that WCAG 3 is looking more at this, but any improvement helps. |
The latest changes were released as part of 9.0.4. |
Contribution guidelines
I want to suggest an idea and checked that ...
Description
The footer text "Made with" (full section reads "Made with Material for MkDocs") which is colored by
--md-footer-fg-color--lighter
does not meet WCAG contrast guidelines in at least some palettes of this theme. I am using theblack
palette, but also notice this on the documentation for Material for MkDocs.I found that changing the value from
#ffffff4d
to#ffffff73
in browser met contrast guidelines while still allowing for visual difference between the plain text and the link next to it, but I am not a front end dev and am not sure how that translates into the hsla setup used in your stylesheet. Perhaps transparency of 0.4 instead of 0.3?Use Cases
This would be a small accessibility fix that would benefit any low vision users. It also helps anyone using relevant palettes to meet WCAG guidelines by default, without having to edit colors further.
Screenshots / Mockups
Current coloration in
black
palette:Here is my version with computed value
#ffffff4d
replaced with#ffffff73
which meets contrast guidelinesThe text was updated successfully, but these errors were encountered: