Skip to main content

A collection of accessible pygments styles

Project description

Accessible pygments themes

conda version pip version conda-forge downloads pip downloads accessible-pygments demo page License

Table of contents

This package includes a collection of accessible themes for pygments based on multiple open-source syntax highlighting themes. The images below show all the themes side by side.

Display of all the light themes side by side

Display of all dark themes side by side

:sparkles: To see examples of the themes in action visit our online demo :sparkles:

Accessibility details ♿️

[!Note] What do we mean by accessible? In this context we are specifically referring to themes which meet the WCAG 2.1 criteria for color contrast. Some themes included are also color-blind friendly.

WCAG 2.1 - AAA compliant

The following themes are AAA compliant with WCAG 2.1 criteria for color contrast.

WCAG 2.1 - AA compliant

The following themes are AA compliant with WCAG 2.1 criteria for color contrast.

Documentation 📖

Installation 💻

accessible-pygments is available through pip and conda.

You can install it through the following commands:

conda install -c conda-forge accessible-pygments

# if you prefer using mamba
mamba install -c conda-forge accessible-pygments
pip install accessible-pygments

If you prefer to install the themes directly from the source:

# clone the repository
git clone git@github.com:Quansight-Labs/accessible-pygments.git
cd accessible-pygments

pip install .

Using the themes directly in your code or app

If you want to directly use the themes in your code, you can do so by importing the theme and passing it to the style argument of the HtmlFormatter class.

from pygments.formatters import HtmlFormatter
HtmlFormatter(style='a11y-light').style
<class 'accessible-pygments.A11yLight'>

Using the themes in your Sphinx documentation

  1. You will need to add accessible-pygments as a dependency to your documentation:

    # for example if using a pyproject.toml file
    dependencies=["accessible-pygments"]
    
  2. Modify your conf.py file to specify the accessible-pygments style:

    "pygments_style": "a11y-light"
    
  3. Build your documentation as usual.

Development and contribution 🌱

You can find our contribution guides on CONTRIBUTING.md. We aim to build a safe and inclusive community, so we have a Code of Conduct that we ask everyone to follow.

Acknowledgments 🤝

We want to thank the following sources for being the source of inspiration for one or more themes that are available in this repository,

License 📑

accessible-pygments is licensed under the OSI BSD-3 Clause license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

accessible_pygments-0.0.5.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

accessible_pygments-0.0.5-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file accessible_pygments-0.0.5.tar.gz.

File metadata

  • Download URL: accessible_pygments-0.0.5.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for accessible_pygments-0.0.5.tar.gz
Algorithm Hash digest
SHA256 40918d3e6a2b619ad424cb91e556bd3bd8865443d9f22f1dcdf79e33c8046872
MD5 3b3ce27e8340fad9f60cb3a633265566
BLAKE2b-256 bcc1bbac6a50d02774f91572938964c582fff4270eee73ab822a4aeea4d8b11b

See more details on using hashes here.

File details

Details for the file accessible_pygments-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for accessible_pygments-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 88ae3211e68a1d0b011504b2ffc1691feafce124b845bd072ab6f9f66f34d4b7
MD5 d87c8d8faa343d24c5705efbe915b5a8
BLAKE2b-256 8d3f95338030883d8c8b91223b4e21744b04d11b161a3ef117295d8241f50ab4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page