Adding accessibility features#
Sphinx extension that provides accessibility features.
Introduction#
This Sphinx extension provides various accessibility features to enhance the usability of Sphinx-generated books. Features include:
Support for dyslexic-friendly fonts
High contrast mode
Installation#
To install the Sphinx-Accessibility extension, follow these steps:
Step 1: Install the Package
Install the Sphinx-Accessibility
package using pip
:
pip install sphinx-accessibility
Step 2: Add to requirements.txt
Make sure that the package is included in your project’s requirements.txt
to track the dependency:
sphinx-accessibility
Step 3: Enable in _config.yml
In your _config.yml
file, add the extension to the list of Sphinx extra extensions:
sphinx:
extra_extensions:
- sphinx_accessibility
Features#
Support for dyslexic-friendly fonts#
This feature allows users to switch to the dyslexic-friendly font OpenDyslexic, improving readability for individuals with dyslexia. The font can be toggled on and off using the button styled as an A surrounded by two arrow heads inside a square with rounded corners in the accessibility menu.
High contrast mode#
This feature allows users to switch to a high contrast mode, improving visibility for individuals with visual impairments. The mode can be toggled on and off using the button styled as half-light half-dark filled circle with small sun beams around it in the accessibility menu.
The high-contrast mode tries to apply the following changes to the CSS:
Change text and border colors to black in light-mode and white in dark-mode.
Change background colors to white in light-mode and black in dark-mode.
Makes all colors twice as intense.
In dark-mode only: increases contrast with factor 1.5.
Example#
You can see how the accessibility features work in this example book.