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

Add colour to version change directives #185

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Mar 29, 2024

Similar to the sidebars in PEP 7 and PEP 8, we can add coloured sidebars and text to the version change directives.

Dark theme

image

Light theme

image

Accessibility check

  • We're not relying on the colour in the sidebar or text to convey meaning. The words remains as before.
  • The text like "Changed in version x.y" is now in colour. The contrast ratio meets at least the WCAG AA guidelines (4.5), with all but one meeting AAA (7.0).
  • In dark mode, the same colour is used for the sidebar and the text:
    • Green: 7.13 (AAA)
    • Yellow: 12.07 (AAA)
    • Red: 4.53 (AA)
  • In light mode, the sidebar colour is the same as in dark mode. The text needs to be darker to be readable:
    • Green: 7.08 (AAA)
    • Orange: 7.11 (AAA)
    • Red: 7.09 (AAA)

versionremoved

I also pre-emptively applied the red styling for the versionremoved directive, which will be released in the next Sphinx 7.3.0 (sphinx-doc/sphinx#11905).

Comparison with other themes

This is similar to how the Awesome theme does it.

These themes also add a background colour:

And Nefertiti for Sphinx adds a coloured box around it.

@hugovk hugovk changed the title Add coloured sidebars to versionadded/changed/deprecated Add colour to version change directives Mar 29, 2024
Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hugovk. I would love to see us move away from red and green. Since the wording is here too, I'm less concerned. When we work with an accessibility designer, we should come up with best practice light/dark themes for accessiblity.

@hugovk hugovk merged commit 5d781d2 into python:main Mar 29, 2024
9 checks passed
@hugovk hugovk deleted the versionchanged-sidebars branch March 29, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants