Similar to the sidebars in PEP 7 and PEP 8, we can add coloured sidebars and text to the version change directives.
Dark theme
Light theme
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:
Similar to the sidebars in PEP 7 and PEP 8, we can add coloured sidebars and text to the version change directives.
Dark theme
Light theme
Accessibility check
versionremoved
I also pre-emptively applied the red styling for the
versionremoved
directive, which will be released in the next Sphinx 7.3.0 (https://github.com/sphinx-doc/sphinx/pull/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.