Skip to content

Conversation

@hugovk
Copy link
Member

@hugovkhugovk 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.

@hugovkhugovk changed the title Add coloured sidebars to versionadded/changed/deprecatedAdd colour to version change directivesMar 29, 2024
Copy link
Contributor

@willingcwillingc 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.

@hugovkhugovk merged commit 5d781d2 into python:mainMar 29, 2024
@hugovkhugovk deleted the versionchanged-sidebars branch March 29, 2024 21:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hugovk@willingc@erlend-aasland