A collection of accessible Pygments styles, currently at version 0.0.5. It provides themes that meet WCAG 2.1 color contrast requirements, aiming to make syntax highlighting more inclusive for users with low vision or color blindness. The library is actively maintained with regular minor releases adding new themes and improvements.
pip install accessible-pygmentsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to highlight Python code using the `a11y-light` style from `accessible-pygments`. The key is to import `accessible_pygments` to register its styles, then refer to the style by its string name when creating a Pygments formatter. The `full=True` option generates a complete HTML document including the stylesheet.
Upgrade to version 0.0.3 or newer to benefit from WCAG 2.1 compliant color contrast. Review your applications to ensure the new color schemes meet your visual and accessibility requirements.
Ensure `accessible-pygments` is in your documentation's dependencies. In your `conf.py`, set `pygments_style = "your-accessible-style-name"`.
Always use the string name of the desired accessible style when initializing Pygments formatters.