├── .github └── workflows │ ├── preview-pr.yml │ └── pypi-package.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── RELEASE.md ├── a11y_pygments ├── __init__.py ├── a11y_dark │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── a11y-dark.png │ └── style.py ├── a11y_high_contrast_dark │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── a11y-high-contrast-dark.png │ └── style.py ├── a11y_high_contrast_light │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── a11y-high-contrast-light.png │ └── style.py ├── a11y_light │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── a11y-light.png │ └── style.py ├── assets │ ├── 000000.png │ ├── 005b82.png │ ├── 00622f.png │ ├── 0072b2.png │ ├── 00749c.png │ ├── 008561.png │ ├── 00e0e0.png │ ├── 023b95.png │ ├── 024c1a.png │ ├── 0550ae.png │ ├── 080808.png │ ├── 116329.png │ ├── 116633.png │ ├── 141414.png │ ├── 18c1c4.png │ ├── 1e1e1e.png │ ├── 24292f.png │ ├── 3d73a9.png │ ├── 437a6b.png │ ├── 515151.png │ ├── 5391cf.png │ ├── 5ca7e4.png │ ├── 622cbc.png │ ├── 66707b.png │ ├── 66ccee.png │ ├── 66e9ec.png │ ├── 6730c5.png │ ├── 6e7781.png │ ├── 6f98b3.png │ ├── 702c00.png │ ├── 72f088.png │ ├── 737373.png │ ├── 797979.png │ ├── 7998f2.png │ ├── 79c0ff.png │ ├── 7ee787.png │ ├── 7f4707.png │ ├── 8045e5.png │ ├── 81b19b.png │ ├── 8250df.png │ ├── 8786ac.png │ ├── 8a4600.png │ ├── 8b949e.png │ ├── 8c8c8c.png │ ├── 912583.png │ ├── 91cbff.png │ ├── 953800.png │ ├── 974eb7.png │ ├── 98661b.png │ ├── 996b00.png │ ├── 9e86c8.png │ ├── 9e8741.png │ ├── 9f4e55.png │ ├── a0111f.png │ ├── a12236.png │ ├── a25e53.png │ ├── a2bffc.png │ ├── a5d6ff.png │ ├── ab6369.png │ ├── abe338.png │ ├── b19db4.png │ ├── b1bac4.png │ ├── b35900.png │ ├── b89784.png │ ├── bbbbbb.png │ ├── bf5400.png │ ├── c4a2f5.png │ ├── c5e478.png │ ├── c9d1d9.png │ ├── caab6d.png │ ├── cc398b.png │ ├── ccbb44.png │ ├── cf222e.png │ ├── d166a3.png │ ├── d2a8ff.png │ ├── d4d0ab.png │ ├── d71835.png │ ├── d9dee3.png │ ├── dbb7ff.png │ ├── dcc6e0.png │ ├── ec8e2c.png │ ├── ee6677.png │ ├── f26196.png │ ├── f5a394.png │ ├── f5ab35.png │ ├── f5f5f5.png │ ├── f78c6c.png │ ├── f8f8f2.png │ ├── fad000.png │ ├── fdac54.png │ ├── fefeff.png │ ├── ff7b72.png │ ├── ff9492.png │ ├── ffa07a.png │ ├── ffa657.png │ ├── ffb757.png │ ├── ffd700.png │ └── ffd900.png ├── blinds_dark │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── blinds-dark.png │ └── style.py ├── blinds_light │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── blinds-light.png │ └── style.py ├── github_dark │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-dark.png │ └── style.py ├── github_dark_colorblind │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-dark-colorblind.png │ └── style.py ├── github_dark_high_contrast │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-dark-high-contrast.png │ └── style.py ├── github_light │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-light.png │ └── style.py ├── github_light_colorblind │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-light-colorblind.png │ └── style.py ├── github_light_high_contrast │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── github-light-high-contrast.png │ └── style.py ├── gotthard_dark │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── gotthard-dark.png │ └── style.py ├── gotthard_light │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── gotthard-light.png │ └── style.py ├── greative │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── greative.png │ └── style.py ├── pitaya_smoothie │ ├── README.md │ ├── __init__.py │ ├── images │ │ └── pitaya-smoothie.png │ └── style.py └── utils │ ├── __init__.py │ ├── utils.py │ └── wcag_contrast.py ├── docs ├── .nojekyll ├── dark_themes.png ├── index.css ├── index.html ├── index.js └── light_themes.png ├── pyproject.toml ├── scripts ├── templates │ └── theme_readme.md └── update_theme_docs.py └── test ├── __init__.py ├── render_html.py ├── run_css.py ├── scripts ├── test.bash ├── test.css ├── test.html ├── test.js ├── test.md └── test.py └── test_contrast.py /.github/workflows/preview-pr.yml: -------------------------------------------------------------------------------- 1 | name: Deploy PR previews on GH pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | concurrency: preview-${{ github.ref }} 12 | env: 13 | FORCE_COLOR: "1" 14 | PYTHONIOENCODING: utf-8 15 | SETUPTOOLS_SCM_PRETEND_VERSION: "1.0" # avoid warnings about shallow checkout 16 | 17 | jobs: 18 | deploy-preview: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Checkout repository 🛎 22 | uses: actions/checkout@v3 23 | 24 | - name: Set up Python 25 | uses: actions/setup-python@v4 26 | with: 27 | python-version: '3.9' 28 | 29 | - name: Install dependencies 📦 30 | run: | 31 | pip install pygments>=1.5 32 | pip install -e .[dev] 33 | 34 | - name: Build the demo pages 📚 35 | run: | 36 | python test/run_css.py --save-dir docs 37 | 38 | - name: Deploy PR Preview 39 | uses: rossjrw/pr-preview-action@v1.2.0 40 | with: 41 | source-dir: docs 42 | preview-branch: gh-pages 43 | 44 | publish-pages: 45 | runs-on: ubuntu-latest 46 | needs: deploy-preview 47 | if: github.event_name == 'push' && github.ref == 'refs/heads/main' 48 | permissions: 49 | contents: write 50 | pages: write 51 | id-token: write 52 | 53 | concurrency: 54 | group: "pages" 55 | cancel-in-progress: false 56 | 57 | environment: 58 | name: github-pages 59 | url: ${{ steps.deployment.outputs.page_url }} 60 | 61 | steps: 62 | - name: Checkout repository 🛎 63 | uses: actions/checkout@v3 64 | 65 | - name: Set up Python 66 | uses: actions/setup-python@v4 67 | with: 68 | python-version: '3.9' 69 | 70 | - name: Install dependencies 📦 71 | run: | 72 | pip install pygments>=1.5 73 | pip install -e .[dev] 74 | 75 | - name: Build the demo pages 📚 76 | run: | 77 | python test/render_html.py 78 | 79 | - name: Setup Pages 🛠 80 | uses: actions/configure-pages@v3 81 | 82 | - name: Upload artifact 📥 83 | uses: actions/upload-pages-artifact@v1 84 | with: 85 | path: "docs" 86 | - name: Deploy to GitHub Pages 🚀 87 | id: deployment 88 | uses: actions/deploy-pages@v2 89 | -------------------------------------------------------------------------------- /.github/workflows/pypi-package.yml: -------------------------------------------------------------------------------- 1 | name: Build and maybe upload PyPI package 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | tags: ["*"] 7 | pull_request: 8 | branches: [main] 9 | release: 10 | types: [published] 11 | workflow_dispatch: 12 | 13 | env: 14 | FORCE_COLOR: "1" # Make tools pretty. 15 | 16 | permissions: 17 | contents: read 18 | 19 | jobs: 20 | # Always build and lint 21 | build-package: 22 | name: Build package 📦 23 | runs-on: ubuntu-latest 24 | 25 | steps: 26 | - name: "Checkout repository 🛎" 27 | uses: actions/checkout@v4 28 | with: 29 | fetch-depth: 0 30 | 31 | - name: "Build and inspect package 🛠" 32 | uses: hynek/build-and-inspect-python-package@v2 33 | 34 | # Upload to Test PyPI on every commit on main. 35 | release-test-pypi: 36 | name: Publish in-dev package to test.pypi.org 37 | environment: release-test-pypi 38 | permissions: 39 | id-token: write 40 | if: github.event_name == 'push' && github.ref == 'refs/heads/main' 41 | runs-on: ubuntu-latest 42 | needs: build-package 43 | 44 | steps: 45 | - name: "Download package built in previous job 📥" 46 | uses: actions/download-artifact@v4 47 | with: 48 | name: Packages 49 | path: dist 50 | - name: "Upload package to Test PyPI 🚀" 51 | uses: pypa/gh-action-pypi-publish@release/v1 52 | with: 53 | repository-url: https://test.pypi.org/legacy/ 54 | 55 | # Upload to real PyPI on GitHub Releases. 56 | release-pypi: 57 | name: Publish released package to pypi.org 🚀 58 | environment: 59 | name: release-pypi 60 | url: https://pypi.org/project/accessible-pygments/ 61 | permissions: 62 | id-token: write 63 | if: github.repository_owner == 'Quansight-Labs' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') 64 | runs-on: ubuntu-latest 65 | needs: build-package 66 | 67 | steps: 68 | - name: "Download packages built in previous job 📥" 69 | uses: actions/download-artifact@v4 70 | with: 71 | name: Packages 72 | path: dist 73 | 74 | - name: "Upload package to PyPI 🚀" 75 | uses: pypa/gh-action-pypi-publish@release/v1 76 | with: 77 | print-hash: true 78 | verbose: true 79 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | .ruff_cache 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | .python-version 87 | 88 | # pipenv 89 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 90 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 91 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 92 | # install all needed dependencies. 93 | #Pipfile.lock 94 | 95 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 96 | __pypackages__/ 97 | 98 | # Celery stuff 99 | celerybeat-schedule 100 | celerybeat.pid 101 | 102 | # SageMath parsed files 103 | *.sage.py 104 | 105 | # Environments 106 | .env 107 | .venv 108 | env/ 109 | venv/ 110 | ENV/ 111 | env.bak/ 112 | venv.bak/ 113 | 114 | # Spyder project settings 115 | .spyderproject 116 | .spyproject 117 | 118 | # Rope project settings 119 | .ropeproject 120 | 121 | # mkdocs documentation 122 | /site 123 | 124 | # mypy 125 | .mypy_cache/ 126 | .dmypy.json 127 | dmypy.json 128 | 129 | # Pyre type checker 130 | .pyre/ 131 | 132 | # macOS store 133 | .DS_Store 134 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # pre-commit is a tool to perform a predefined set of tasks manually and/or 2 | # automatically before git commits are made. 3 | # 4 | # Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level 5 | # 6 | # Common tasks 7 | # 8 | # - Register git hooks: pre-commit install --install-hooks 9 | # - Run on all files: pre-commit run --all-files 10 | 11 | # We run pre-commit as part of our CI and run scheduled updates 12 | ci: 13 | autoupdate_schedule: monthly 14 | autofix_commit_msg: | 15 | [pre-commit.ci] Apply automatic pre-commit fixes 16 | 17 | repos: 18 | # general 19 | - repo: https://github.com/pre-commit/pre-commit-hooks 20 | rev: v5.0.0 21 | hooks: 22 | - id: end-of-file-fixer 23 | - id: trailing-whitespace 24 | - id: check-toml 25 | - id: check-yaml 26 | 27 | # python 28 | - repo: https://github.com/psf/black 29 | rev: 25.1.0 30 | hooks: 31 | - id: black 32 | exclude: ^test/scripts/ 33 | 34 | - repo: https://github.com/astral-sh/ruff-pre-commit 35 | rev: v0.9.4 36 | hooks: 37 | - id: ruff 38 | 39 | - repo: https://github.com/pycqa/isort 40 | rev: 6.0.0 41 | hooks: 42 | - id: isort 43 | name: isort 44 | additional_dependencies: [toml] 45 | files: \.py$ 46 | 47 | - repo: https://github.com/pre-commit/mirrors-prettier 48 | rev: v4.0.0-alpha.8 49 | hooks: 50 | - id: prettier 51 | types_or: [css, markdown, html] 52 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Version 0.0.5 (29-04-2024) 2 | 3 | - MAINT - Add pre-commits and update docs by @trallard in https://github.com/Quansight-Labs/accessible-pygments/pull/26 4 | - ENH - Move to hatch for dev/build by @trallard in https://github.com/Quansight-Labs/accessible-pygments/pull/27 5 | - MAINT - Delete docs/all_themes.pptx by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/40 6 | - [DOC] Remove conda instructions from contributing by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/39 7 | - ENH - Remove build artifacts from the repo by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/41 8 | - ENH - Automate theme READMEs by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/42 9 | - MAINT - Miscellaneous updates by @trallard in https://github.com/Quansight-Labs/accessible-pygments/pull/46 10 | - BUG - Ensure no local version by @trallard in https://github.com/Quansight-Labs/accessible-pygments/pull/48 11 | - ENH - Automate theme README screenshots by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/43 12 | - MAINT - Update pre-commit hooks by @trallard in https://github.com/Quansight-Labs/accessible-pygments/pull/45 13 | - BUG - Fix contrast failures for high contrast light theme by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/33 14 | - ENH -Fix broken theme URLs in README, typo in demo html by @meli-lewis in https://github.com/Quansight-Labs/accessible-pygments/pull/53 15 | - ENH - Update code to not get images from placeholder.com by @Carreau in https://github.com/Quansight-Labs/accessible-pygments/pull/51 16 | - ENH -Reflect that rgb colors are in 0-1 and floats. by @Carreau in https://github.com/Quansight-Labs/accessible-pygments/pull/52 17 | - ENH - Small refactor of color utils for readibility and type checkability by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/55 18 | - ENH - Rename hex to float function by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/57 19 | - ENH - Set a11y-light default background to #f2f2f2 (light gray) by @gabalafou in https://github.com/Quansight-Labs/accessible-pygments/pull/56 20 | 21 | ### New Contributors 22 | 23 | - @trallard made their first contribution in https://github.com/Quansight-Labs/accessible-pygments/pull/26 24 | - @pre-commit-ci made their first contribution in https://github.com/Quansight-Labs/accessible-pygments/pull/28 25 | - @gabalafou made their first contribution in https://github.com/Quansight-Labs/accessible-pygments/pull/40 26 | - @meli-lewis made their first contribution in https://github.com/Quansight-Labs/accessible-pygments/pull/53 27 | - @Carreau made their first contribution in https://github.com/Quansight-Labs/accessible-pygments/pull/51 28 | 29 | ## Version 0.0.4 (22-03-2023) 30 | 31 | - Merge pull request #24 from mgorny/setup-exclude. [Tania Allard] 32 | 33 | Exclude "test" package from being installed 34 | 35 | - Exclude "test" package from being installed. [Michał Górny] 36 | 37 | Add `test` to exclude for `find_packages()`, to prevent the package 38 | from wrongly installing the `test` directory into site-packages, e.g.: 39 | 40 | /usr/lib/python3.11/site-packages/test 41 | 42 | ## Version 0.0.3 (09-02-2023) 43 | 44 | - Merge pull request #22 from Quansight-Labs/update-readme. [Stephannie 45 | Jimenez Gacha] 46 | 47 | Document accessibility features in main readme 48 | 49 | - Document accessibility features in main readme. [Stephannie Jimenez] 50 | - Merge pull request #20 from Quansight-Labs/fix-highlight. [Stephannie 51 | Jimenez Gacha] 52 | 53 | Check the highlight color and add highlighted examples to the demo page 54 | 55 | - Update themes readme with new colors. [Stephannie Jimenez] 56 | - Check the highlight color and add highlighted examples to the demo 57 | page. [Stephannie Jimenez] 58 | - Set development version to 0.0.3. [Stephannie Jimenez] 59 | - Release v0.0.2. [Stephannie Jimenez] 60 | - Update changelog. [Stephannie Jimenez] 61 | 62 | # Version 0.0.2 (08-11-2022) 63 | 64 | - Merge pull request #18 from Quansight-Labs/update-docs. [Stephannie 65 | Jimenez Gacha] 66 | 67 | Improve readme 68 | 69 | - Add direct links to demo page and replace the gif with static image of 70 | all the current themes. [Stephannie Jimenez] 71 | - Merge pull request #17 from Quansight-Labs/add-creative. [Stephannie 72 | Jimenez Gacha] 73 | 74 | Add greative theme 75 | 76 | - Add greative to main readme. [Stephannie Jimenez] 77 | - Add greative theme. [Stephannie Jimenez] 78 | - Merge pull request #16 from Quansight-Labs/add-blinds. [Stephannie 79 | Jimenez Gacha] 80 | 81 | Add blinds themes 82 | 83 | - Add color theme names in main readme. [Stephannie Jimenez] 84 | - Add blinds dark theme. [Stephannie Jimenez] 85 | - Add blinds light theme. [Stephannie Jimenez] 86 | - Merge pull request #14 from Quansight-Labs/add-gotthard. [Stephannie 87 | Jimenez Gacha] 88 | - Add gotthard light theme. [Stephannie Jimenez] 89 | - Add gotthard dark theme. [Stephannie Jimenez] 90 | - Center gif. [Stephannie Jimenez] 91 | - Upload gif with themes. [Stephannie Jimenez] 92 | - Update supported themes. [Stephannie Jimenez Gacha] 93 | - Merge pull request #11 from Quansight-Labs/add-github-hcontrast. 94 | [Stephannie Jimenez Gacha] 95 | 96 | Add github light and dark high contrast 97 | 98 | - Add github light high contrast theme. [Stephannie Jimenez] 99 | - Add github dark high contrast theme. [Stephannie Jimenez] 100 | - Update theme list. [Stephannie Jimenez Gacha] 101 | - Fix typos. [Stephannie Jimenez] 102 | - Merge pull request #9 from Quansight-Labs/github-light-colorblind. 103 | [Stephannie Jimenez Gacha] 104 | 105 | Add github light colorblind theme 106 | 107 | - Add github light colorblind theme. [Stephannie Jimenez] 108 | - Update current themes. [Stephannie Jimenez Gacha] 109 | - Merge pull request #8 from Quansight-Labs/add-github-dark-colorblind. 110 | [Stephannie Jimenez Gacha] 111 | 112 | Add github dark colorblind theme 113 | 114 | - Add github dark colorblind theme. [Stephannie Jimenez] 115 | - Merge pull request #7 from Quansight-Labs/fix-github-light. 116 | [Stephannie Jimenez Gacha] 117 | 118 | Fix github light theme 119 | 120 | - Update screenshot. [Stephannie Jimenez] 121 | - Update readme. [Stephannie Jimenez] 122 | - Fix github light colors. [Stephannie Jimenez] 123 | - Merge pull request #6 from Quansight-Labs/github-dark-theme. 124 | [Stephannie Jimenez Gacha] 125 | 126 | Add `github-dark` theme 127 | 128 | - Fix typo. [Stephannie Jimenez] 129 | - Add readme.md. [Stephannie Jimenez] 130 | - Add github-dark theme. [Stephannie Jimenez] 131 | - Merge pull request #5 from Quansight-Labs/github-light-theme. 132 | [Stephannie Jimenez Gacha] 133 | 134 | Add `github light` theme 135 | 136 | - Add github light theme. [Stephannie Jimenez] 137 | - Merge pull request #4 from Quansight-Labs/move-images. [Stephannie 138 | Jimenez Gacha] 139 | 140 | Move theme images to corresponding folder 141 | 142 | - Move theme images to corresponding folder. [Stephannie Jimenez] 143 | - Add badges. [Stephannie Jimenez] 144 | - Fix css loading in demo. [Stephannie Jimenez] 145 | - Move demo page to docs folder. [Stephannie Jimenez] 146 | - Update README.md installation. [Stephannie Jimenez Gacha] 147 | - Set development version to 0.0.2. [Stephannie Jimenez] 148 | - Release v0.0.1. [Stephannie Jimenez] 149 | - Create changelog and release instructions. [Stephannie Jimenez] 150 | 151 | ## Version 0.0.1 ( 06-08-2022 ) 152 | 153 | - Update contributing guide. [Stephannie Jimenez] 154 | - Add working demo. [Stephannie Jimenez] 155 | - Fix autogenerated css and start working on static demo. [Stephannie Jimenez] 156 | - Refactoring for automatic theme discovery. [Stephannie Jimenez] 157 | - Add contributing.md and minor refactoring. [Stephannie Jimenez] 158 | - Add pitaya-smoothie to main readme. [Stephannie Jimenez] 159 | - Add image. [Stephannie Jimenez] 160 | - Add pitaya smoothie theme. [Stephannie Jimenez] 161 | - Fix readme in each theme. [Stephannie Jimenez] 162 | - Refactor themes and readme. [Stephannie Jimenez] 163 | - Add light high contrast mode. [Stephannie Jimenez] 164 | - Fix typo. [Stephannie Jimenez] 165 | - Add high contrast dark theme. [Stephannie Jimenez] 166 | - Reorganize colors. [Stephannie Jimenez] 167 | - Add example images. [Stephannie Jimenez] 168 | - Add contrast checks for light theme. [Stephannie Jimenez] 169 | - Make colors bigger. [Stephannie Jimenez] 170 | - Add dark theme contrast ratio. [Stephannie Jimenez] 171 | - Add readme and minor color fixes. [Stephannie Jimenez] 172 | - Rename files and add scripts for multiple languages. [Stephannie Jimenez] 173 | - Add first iteration of dark theme. [Stephannie Jimenez] 174 | - Fix setup.py, add tests and first iteration of light theme. [Stephannie Jimenez] 175 | - Add structure files. [Stephannie Jimenez] 176 | - Initial commit. [Tania Allard] 177 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | - Demonstrating empathy and kindness toward other people 21 | - Being respectful of differing opinions, viewpoints, and experiences 22 | - Giving and gracefully accepting constructive feedback 23 | - Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | - Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | - The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | - Trolling, insulting or derogatory comments, and personal or political attacks 33 | - Public or private harassment 34 | - Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | - Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official email address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at: **trallard [at] bitsandchips.me**. 63 | All complaints will be reviewed and investigated promptly and fairly. 64 | 65 | All community leaders are obligated to respect the privacy and security of the 66 | reporter of any incident. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these Community Impact Guidelines in determining 71 | the consequences for any action they deem in violation of this Code of Conduct: 72 | 73 | ### 1. Correction 74 | 75 | **Community Impact**: Use of inappropriate language or other behavior deemed 76 | unprofessional or unwelcome in the community. 77 | 78 | **Consequence**: A private, written warning from community leaders, providing 79 | clarity around the nature of the violation and an explanation of why the 80 | behavior was inappropriate. A public apology may be requested. 81 | 82 | ### 2. Warning 83 | 84 | **Community Impact**: A violation through a single incident or series of 85 | actions. 86 | 87 | **Consequence**: A warning with consequences for continued behavior. No 88 | interaction with the people involved, including unsolicited interaction with 89 | those enforcing the Code of Conduct, for a specified period of time. This 90 | includes avoiding interactions in community spaces as well as external channels 91 | like social media. Violating these terms may lead to a temporary or permanent 92 | ban. 93 | 94 | ### 3. Temporary Ban 95 | 96 | **Community Impact**: A serious violation of community standards, including 97 | sustained inappropriate behavior. 98 | 99 | **Consequence**: A temporary ban from any sort of interaction or public 100 | communication with the community for a specified period of time. No public or 101 | private interaction with the people involved, including unsolicited interaction 102 | with those enforcing the Code of Conduct, is allowed during this period. 103 | Violating these terms may lead to a permanent ban. 104 | 105 | ### 4. Permanent Ban 106 | 107 | **Community Impact**: Demonstrating a pattern of violation of community 108 | standards, including sustained inappropriate behavior, harassment of an 109 | individual, or aggression toward or disparagement of classes of individuals. 110 | 111 | **Consequence**: A permanent ban from any sort of public interaction within the 112 | community. 113 | 114 | ## Attribution 115 | 116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 117 | version 2.1, available at 118 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 119 | 120 | Community Impact Guidelines were inspired by 121 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 122 | 123 | For answers to common questions about this code of conduct, see the FAQ at 124 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 125 | [https://www.contributor-covenant.org/translations][translations]. 126 | 127 | [homepage]: https://www.contributor-covenant.org 128 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 129 | [Mozilla CoC]: https://github.com/mozilla/diversity 130 | [FAQ]: https://www.contributor-covenant.org/faq 131 | [translations]: https://www.contributor-covenant.org/translations 132 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to accessible pygments themes 2 | 3 | Welcome! And thanks for taking your time to contribute to this project 🤩 4 | 5 | - [Contributing to accessible pygments themes](#contributing-to-accessible-pygments-themes) 6 | - [Submit an issue 📬](#submit-an-issue-) 7 | - [Contributing to this package](#contributing-to-this-package) 8 | - [Pre-requisites 📦](#pre-requisites-) 9 | - [Creating your development environment 👩🏻‍💻 👨🏼‍💻](#creating-your-development-environment--) 10 | - [Running the tests](#running-the-tests) 11 | - [Rendering the HTML examples](#rendering-the-html-examples) 12 | - [Linting and formatting](#linting-and-formatting) 13 | - [Adding a new theme 🎨](#adding-a-new-theme-) 14 | - [Where to add a new theme 👩🏼‍🎨](#where-to-add-a-new-theme-) 15 | - [Customize your `style.py` file](#customize-your-stylepy-file) 16 | - [Visualize and debug your theme](#visualize-and-debug-your-theme) 17 | - [Update the `README.md` file](#update-the-readmemd-file) 18 | - [Add your theme to our static page](#add-your-theme-to-our-static-page) 19 | - [Create a Pull Request](#create-a-pull-request) 20 | 21 | ## Submit an issue 📬 22 | 23 | Please share your thoughts on fixes and features [in the issue tracker](https://github.com/Quansight-Labs/accessible-pygments/issues). 24 | When doing so, add a clear description, and provide as much information as possible about your environment. 25 | 26 | ## Contributing to this package 27 | 28 | ### Pre-requisites 📦 29 | 30 | You will need to have the following installed locally: 31 | 32 | - `git` 33 | - Python >= 3.9 34 | - [hatch](https://hatch.pypa.io/) 35 | 36 | ### Creating your development environment 👩🏻‍💻 👨🏼‍💻 37 | 38 | 1. Fork this repository to your GitHub account, then clone it to your local machine: 39 | 40 | ```bash 41 | git clone https://github.com//accessible-pygments.git 42 | ``` 43 | 44 | Remember that this fork is a copy of the repository and any changes in it don't affect the original one. 45 | 46 | 2. From here you can create your local environments with hatch: 47 | 48 | ```bash 49 | hatch env create 50 | ``` 51 | 52 | 3. You can verify that the environment was created successfully by running: 53 | 54 | ```console 55 | $ hatch env show 56 | ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ 57 | ┃ Name ┃ Type ┃ Dependencies ┃ Scripts ┃ 58 | ┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ 59 | │ default │ virtual │ │ │ 60 | ├─────────┼─────────┼──────────────┼───────────────────┤ 61 | │ dev │ virtual │ │ css │ 62 | │ │ │ │ render_html │ 63 | | | | | update_theme_docs | 64 | ├─────────┼─────────┼──────────────┼───────────────────┤ 65 | │ test │ virtual │ hypothesis │ tests │ 66 | │ │ │ pytest │ │ 67 | └─────────┴─────────┴──────────────┴───────────────────┘ 68 | ``` 69 | 70 | ### Running the tests 71 | 72 | You can run the tests directly with hatch: 73 | 74 | ```bash 75 | hatch run test:tests 76 | ``` 77 | 78 | ### Rendering the HTML examples 79 | 80 | You can generate individual HTML files for each of the themes included in `accessible_pygments` by running: 81 | 82 | ```bash 83 | hatch run dev:render_html 84 | ``` 85 | 86 | This will add the HTML files under `docs/` for each supported theme. 87 | We recommend using your favorite browser to see the rich HTML output. 88 | 89 | ### Linting and formatting 90 | 91 | We use several linters and formatters to ensure the code is consistent and clean. 92 | You can run this with: 93 | 94 | ```bash 95 | hatch run dev:lint 96 | ``` 97 | 98 | ## Adding a new theme 🎨 99 | 100 | ### Where to add a new theme 👩🏼‍🎨 101 | 102 | Our package is divided by themes, where each folder has the style of each theme, a description in Markdown and the source CSS file. 103 | 104 | ```text 105 | ├── a11y_pygments 106 | │ ├── a11y_dark 107 | │ │ ├── style.py 108 | │ │ ├── style.css 109 | │ │ ├── README.md 110 | │ ├── a11y_light 111 | │ │ ├── style.py 112 | │ │ ├── style.css 113 | │ │ ├── README.md 114 | ``` 115 | 116 | To add a new theme, please create a folder with your new theme name, like `white-cats` and add the three files 117 | described before (so that it matches the rest of the themes). 118 | 119 | ### Customize your `style.py` file 120 | 121 | You can use as a base one of our existing themes, this file needs to define a new class named `Theme` with the new colors and rules you want. 122 | 123 | > **NOTE** 📝 124 | > Please try to encapsulate all the raw colors in the `Colors` `enum` and call them in the rules section. 125 | > This will help us with maintenance 🙏. 126 | 127 | ### Visualize and debug your theme 128 | 129 | While working on your theme, it might be helpful to generate example HTML files with the following command: 130 | 131 | ```bash 132 | hatch run dev:render_html 133 | ``` 134 | 135 | The HTML files are generated from sample source code files located under `tests/scripts`. 136 | 137 | If successful, you should be able to see the results of your new theme applied to those code files under `docs/_build/`. 138 | 139 | If you prefer to inspect the CSS separately from the HTML, use the following command: 140 | 141 | ```bash 142 | hatch run dev:create_css 143 | ``` 144 | 145 | This will add the CSS file under `docs/_build/css/.css`. 146 | 147 | ### Update the `README.md` file 148 | 149 | Once you are happy with the colors and the rules in the style file, please update the README for your new theme! You can generate a README with the following command: 150 | 151 | ```bash 152 | hatch run dev:update_theme_docs your_theme_module_name 153 | ``` 154 | 155 | This script will: 156 | 157 | - generate a table of contrast ratios of the colors you've chosen and their compliance with WCAG, 158 | - pull the docstring from the `Theme` class and put it in the README as the description for your theme (if you are porting a theme or color 159 | palette developed elsewhere please acknowledge your source(s) in the docstring of the `Theme` class), 160 | - take a screenshot of your theme applied to a code sample, save it at `a11y_pygments//images/.png`, and embed it in the theme README. 161 | 162 | Also, don't forget to add the name of your theme to our list of supported themes in the [main README](README.md). 163 | 164 | #### Add your theme to our static page 165 | 166 | We have a demo page where you will be able to change the style of different languages at the same time. 167 | To add your new theme: 168 | 169 | 1. Open the `[docs/index.html](docs/index.html)` file. 170 | 2. Add your new theme name to the `themes` section: 171 | 172 | With this change, you will be able to open `docs/index.html` in your favorite browser and find your new theme in our demo! 173 | 174 | ### Create a Pull Request 175 | 176 | Once you have added and verified your theme you should be ready to open a Pull Request 👏🏻 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Quansight Labs 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Accessible pygments themes 2 | 3 | [![conda version](https://img.shields.io/conda/vn/conda-forge/accessible-pygments?color=0553F2&style=flat.svg)](https://anaconda.org/conda-forge/accessible-pygments) 4 | [![pip version](https://img.shields.io/pypi/v/accessible-pygments?color=0553F2&flat.svg)](https://pypi.org/project/accessible-pygments/) 5 | [![conda-forge downloads](https://img.shields.io/conda/dn/conda-forge/accessible-pygments?color=0553F2&label=conda-forge%20downloads%20&flat.svg)](https://anaconda.org/conda-forge/accessible-pygments) 6 | [![pip downloads](https://img.shields.io/pypi/dm/accessible-pygments?color=0553F2&label=PyPI%20downloads&flat.svg)](https://pypi.org/project/accessible-pygments/) 7 | [![accessible-pygments demo page](https://img.shields.io/badge/Demo-Click%20this%20badge!%20✨-blueviolet?flat.svg)](https://quansight-labs.github.io/accessible-pygments/) 8 | [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](./LICENSE) 9 | 10 | ## Table of contents 11 | 12 | - [Accessible pygments themes](#accessible-pygments-themes) 13 | - [Table of contents](#table-of-contents) 14 | - [Accessibility details ♿️](#accessibility-details-️) 15 | - [WCAG 2.1 - AAA compliant](#wcag-21---aaa-compliant) 16 | - [WCAG 2.1 - AA compliant](#wcag-21---aa-compliant) 17 | - [Documentation 📖](#documentation-) 18 | - [Installation 💻](#installation-) 19 | - [Using the themes directly in your code or app](#using-the-themes-directly-in-your-code-or-app) 20 | - [Using the themes in your Sphinx documentation](#using-the-themes-in-your-sphinx-documentation) 21 | - [Development and contribution 🌱](#development-and-contribution-) 22 | - [Acknowledgments 🤝](#acknowledgments-) 23 | - [License 📑](#license-) 24 | 25 | This package includes a collection of accessible themes for [pygments](https://pygments.org/) based on multiple open-source syntax highlighting themes. The images below show all the themes side by side. 26 | 27 | ![Display of all the light themes side by side](./docs/light_themes.png) 28 | 29 | ![Display of all dark themes side by side](./docs/dark_themes.png) 30 | 31 | :sparkles: To see examples of the themes in action [visit our online demo](https://quansight-labs.github.io/accessible-pygments/) :sparkles: 32 | 33 | ## Accessibility details ♿️ 34 | 35 | > [!Note] 36 | > 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](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html). 37 | > Some themes included are also color-blind friendly. 38 | 39 | ### WCAG 2.1 - AAA compliant 40 | 41 | The following themes are AAA compliant with [WCAG 2.1 criteria for color contrast](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). 42 | 43 | - [`a11y-dark`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/a11y_dark) 44 | - [`a11y-high-contrast-dark`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/a11y_high_contrast_dark) 45 | - [`pitaya-smoothie`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/pitaya_smoothie) - Color-blind friendly. 46 | - [`github-light`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_light) - Color-blind friendly. 47 | - [`github-dark`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_dark) - Color-blind friendly. 48 | - [`github-light-colorblind`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_light_colorblind) - Color-blind friendly. 49 | - [`github-dark-colorblind`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_dark_colorblind) - Color-blind friendly. 50 | - [`github-light-high-contrast`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_light_high_contrast) - Color-blind friendly. 51 | - [`github-dark-high-contrast`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/github_dark_high_contrast) - Color-blind friendly. 52 | - [`gotthard-dark`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/gotthard_dark) - Color-blind friendly. 53 | 54 | ### WCAG 2.1 - AA compliant 55 | 56 | The following themes are AA compliant with [WCAG 2.1 criteria for color contrast](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). 57 | 58 | - [`a11y-light`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/a11y_light) 59 | - [`a11y-high-contrast-light`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/a11y_high_contrast_light) 60 | - [`gotthard-light`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/gotthard_light) - Color-blind friendly. 61 | - [`blinds-light`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/blinds_light) - Color-blind friendly. 62 | - [`blinds-dark`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/blinds_dark) - Color-blind friendly. 63 | - [`greative`](https://github.com/Quansight-Labs/accessible-pygments/tree/main/a11y_pygments/greative) - Accessible to most forms of colorblindness and low light settings. 64 | 65 | ## Documentation 📖 66 | 67 | ### Installation 💻 68 | 69 | `accessible-pygments` is available through pip and conda. 70 | 71 | You can install it through the following commands: 72 | 73 | ```bash 74 | conda install -c conda-forge accessible-pygments 75 | 76 | # if you prefer using mamba 77 | mamba install -c conda-forge accessible-pygments 78 | ``` 79 | 80 | ```bash 81 | pip install accessible-pygments 82 | ``` 83 | 84 | If you prefer to install the themes directly from the source: 85 | 86 | ```bash 87 | # clone the repository 88 | git clone git@github.com:Quansight-Labs/accessible-pygments.git 89 | cd accessible-pygments 90 | 91 | pip install . 92 | ``` 93 | 94 | ### Using the themes directly in your code or app 95 | 96 | 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. 97 | 98 | ```python 99 | from pygments.formatters import HtmlFormatter 100 | HtmlFormatter(style='a11y-light').style 101 | 102 | ``` 103 | 104 | ### Using the themes in your Sphinx documentation 105 | 106 | 1. You will need to add `accessible-pygments` as a dependency to your documentation: 107 | 108 | ```toml 109 | # for example if using a pyproject.toml file 110 | dependencies=["a11y_pygments"] 111 | ``` 112 | 113 | 2. Modify your `conf.py` file to specify the `accessible-pygments` style: 114 | 115 | ```python 116 | "pygments_style": "a11y-light" 117 | ``` 118 | 119 | 3. Build your documentation as usual. 120 | 121 | ## Development and contribution 🌱 122 | 123 | You can find our contribution guides on [CONTRIBUTING.md](CONTRIBUTING.md). 124 | We aim to build a safe and inclusive community, so we have a [Code of Conduct](CODE_OF_CONDUCT.md) that we ask everyone to follow. 125 | 126 | ## Acknowledgments 🤝 127 | 128 | We want to thank the following sources for being the source of inspiration for one or more themes that are available in this repository, 129 | 130 | - [a11y dark and light syntax highlighting](https://github.com/ericwbailey/a11y-syntax-highlighting). 131 | - [pitaya smoothie VSCode theme](https://github.com/trallard/pitaya_smoothie). 132 | - [github VSCode themes](https://github.com/primer/github-vscode-theme). 133 | - [gotthard VSCode themes](https://github.com/janbiasi/vscode-gotthard-theme/). 134 | - [blinds VSCode themes](https://github.com/orbulant/blinds-theme). 135 | - [greative VSCode theme](https://github.com/SumanKhdka/Greative-vscode-Theme). 136 | 137 | ## License 📑 138 | 139 | `accessible-pygments` is licensed under the [OSI BSD-3 Clause license](./LICENSE). 140 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Making a release 2 | 3 | Follow these instructions to make a new release of the `accessible-pygments` package. 4 | 5 | 1. Create a new branch for the release 6 | 7 | ```bash 8 | git checkout -b release-vX.X.X 9 | ``` 10 | 11 | 2. Document the changes since the last release 12 | 13 | - Update the `CHANGELOG.md` with `gitchangelog` or any other tool of your choice 14 | - Commit the changes `git add && git commit -m "Update changelog"` 15 | 16 | 3. Check the package locally 17 | 18 | ```bash 19 | # since we use vcs to dynamically set the tag you can check with hatch 20 | $ hatch version 21 | 22 | 0.0.5.dev18+g8b0f6ba.d20230403 23 | 24 | # build locally and check the artifacts 25 | $ hatch build 26 | 27 | [sdist] 28 | dist/accessible_pygments-0.0.5.dev19+g076246a.d20230403.tar.gz 29 | 30 | [wheel] 31 | dist/accessible_pygments-0.0.5.dev19+g076246a.d20230403-py3-none-any.whl 32 | 33 | # check the contents 34 | twine check dist/* 35 | 36 | # clean the build artifacts 37 | hatch clean 38 | ``` 39 | 40 | 4. Submit the PR, and merge the release branch into main once approved. 41 | 5. After merge: check the build artifacts from the GitHub actions workflow 42 | 6. Prepare the release commit - checkout the branch for the release and make sure it is to date and the repo is clean: 43 | 44 | ```bash 45 | git checkout main 46 | git fetch && git pull 47 | git clean -xdfi 48 | ``` 49 | 50 | 7. Tag the release with the version number and push the tag to GitHub 51 | 52 | ```bash 53 | git tag -a vX.X.X -m 'Release x.x.x' 54 | git push --tags 55 | ``` 56 | 57 | If you need to course-correct and delete the tag: 58 | 59 | ```bash 60 | git tag -d vX.X.X 61 | git push --delete origin vX.X.X 62 | ``` 63 | 64 | 8. Check that the release was published correctly 65 | -------------------------------------------------------------------------------- /a11y_pygments/__init__.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | 4 | logger = logging.getLogger() 5 | 6 | logging.basicConfig( 7 | format="# %(asctime)s %(levelname)s %(name)s %(filename)s:%(lineno)s -- %(message)s\n", 8 | level=logging.INFO, 9 | ) 10 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_dark/README.md: -------------------------------------------------------------------------------- 1 | # A11Y Dark 2 | 3 | This is the Pygments implementation of a11y-dark from [Eric Bailey's 4 | accessible themes for syntax 5 | highlighting](https://github.com/ericwbailey/a11y-syntax-highlighting) 6 | 7 | ![Screenshot of the a11y-dark theme in a bash script](./images/a11y-dark.png) 8 | 9 | ## Colors 10 | 11 | Background color: ![#2b2b2b](https://via.placeholder.com/20/2b2b2b/2b2b2b.png) `#2b2b2b` 12 | 13 | Highlight color: ![#ffd9002e](https://via.placeholder.com/20/ffd9002e/ffd9002e.png) `#ffd9002e` 14 | 15 | **WCAG compliance** 16 | 17 | | Color | Hex | Ratio | Normal text | Large text | 18 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 19 | | ![#d4d0ab](../../a11y_pygments/assets/d4d0ab.png) | `#d4d0ab` | 9.0 : 1 | AAA | AAA | 20 | | ![#ffa07a](../../a11y_pygments/assets/ffa07a.png) | `#ffa07a` | 7.1 : 1 | AAA | AAA | 21 | | ![#f5ab35](../../a11y_pygments/assets/f5ab35.png) | `#f5ab35` | 7.3 : 1 | AAA | AAA | 22 | | ![#ffd700](../../a11y_pygments/assets/ffd700.png) | `#ffd700` | 10.1 : 1 | AAA | AAA | 23 | | ![#abe338](../../a11y_pygments/assets/abe338.png) | `#abe338` | 9.3 : 1 | AAA | AAA | 24 | | ![#00e0e0](../../a11y_pygments/assets/00e0e0.png) | `#00e0e0` | 8.6 : 1 | AAA | AAA | 25 | | ![#dcc6e0](../../a11y_pygments/assets/dcc6e0.png) | `#dcc6e0` | 8.9 : 1 | AAA | AAA | 26 | | ![#f8f8f2](../../a11y_pygments/assets/f8f8f2.png) | `#f8f8f2` | 13.3 : 1 | AAA | AAA | 27 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_dark/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_dark/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/a11y_dark/images/a11y-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_dark/images/a11y-dark.png -------------------------------------------------------------------------------- /a11y_pygments/a11y_dark/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#d4d0ab" 20 | red = "#ffa07a" 21 | orange = "#f5ab35" 22 | yellow = "#ffd700" 23 | green = "#abe338" 24 | blue = "#00e0e0" 25 | purple = "#dcc6e0" 26 | black = "#f8f8f2" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This is the Pygments implementation of a11y-dark from [Eric Bailey's 32 | accessible themes for syntax 33 | highlighting](https://github.com/ericwbailey/a11y-syntax-highlighting) 34 | """ 35 | 36 | default_style = "" 37 | 38 | background_color = "#2b2b2b" 39 | highlight_color = "#ffd9002e" 40 | 41 | styles = { 42 | Text: Colors.black, # class: '' 43 | Error: Colors.red, # class: 'err' 44 | Other: "", # class 'x' 45 | Comment: Colors.comment, # class: 'c' 46 | Keyword: Colors.purple, # class: 'k' 47 | Keyword.Constant: Colors.purple, # class: 'kc' 48 | # Keyword.Declaration: "", # class: 'kd' 49 | # Keyword.Namespace: "", # class: 'kn' 50 | # Keyword.Pseudo: "", # class: 'kp' 51 | # Keyword.Reserved: "", # class: 'kr' 52 | Keyword.Type: Colors.orange, # class: 'kt' 53 | Operator: Colors.green, # class: 'o' 54 | Operator.Word: Colors.purple, # class: 'ow' 55 | Punctuation: Colors.black, # class: 'p' 56 | Name: Colors.black, # class: 'n' 57 | Name.Attribute: Colors.yellow, # class: 'na' 58 | Name.Builtin: Colors.orange, # class: 'nb' 59 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 60 | Name.Class: Colors.blue, # class: 'nc' 61 | Name.Constant: Colors.blue, # class: 'no' 62 | Name.Decorator: Colors.orange, # class: 'nd' 63 | Name.Entity: Colors.green, # class: 'ni' 64 | Name.Exception: Colors.purple, # class: 'ne' 65 | Name.Function: Colors.blue, # class: 'nf' 66 | Name.Property: Colors.blue, # class: 'py' 67 | Name.Label: Colors.orange, # class: 'nl' 68 | Name.Namespace: Colors.black, # class: 'nn' 69 | # Name.Other: "", # class: 'nx' 70 | Name.Tag: Colors.blue, # class: 'nt' 71 | Name.Variable: Colors.red, # class: 'nv' 72 | Name.Variable.Magic: Colors.orange, 73 | # Name.Variable.Class: "", # class: 'vc' 74 | # Name.Variable.Global: "", # class: 'vg' 75 | # Name.Variable.Instance: "", # class: 'vi' 76 | Number: Colors.orange, # class: 'm' 77 | # Number.Float: "", # class: 'mf' 78 | # Number.Hex: "", # class: 'mh' 79 | # Number.Integer: "", # class: 'mi' 80 | # Number.Integer.Long: "", # class: 'il' 81 | # Number.Oct: "", # class: 'mo' 82 | Literal: Colors.orange, # class: 'l' 83 | # Literal.Date: "", # class: 'ld' 84 | String: Colors.green, # class: 's' 85 | String.Backtick: Colors.green, # class: 'sb' 86 | # String.Char: "", # class: 'sc' 87 | # String.Doc: "", # class: 'sd' 88 | # String.Double: "", # class: 's2' 89 | # String.Escape: "", # class: 'se' 90 | # String.Heredoc: "", # class: 'sh' 91 | # String.Interpol: "", # class: 'si' 92 | # String.Other: "", # class: 'sx' 93 | String.Regex: Colors.red, # class: 'sr' 94 | # String.Single: "", # class: 's1' 95 | String.Symbol: Colors.blue, # class: 'ss' 96 | # Generic: "", # class: 'g' 97 | Generic.Deleted: Colors.blue, # class: 'gd', 98 | Generic.Emph: "italic", # class: 'ge' 99 | # Generic.Error: "", # class: 'gr' 100 | Generic.Heading: Colors.blue, # class: 'gh' 101 | Generic.Subheading: Colors.blue, # class: 'gu' 102 | # Generic.Inserted: "", # class: 'gi' 103 | # Generic.Output: "", # class: 'go' 104 | # Generic.Prompt: "", # class: 'gp' 105 | Generic.Strong: "bold", # class: 'gs' 106 | # Generic.Traceback: "", # class: 'gt' 107 | } 108 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_dark/README.md: -------------------------------------------------------------------------------- 1 | # A11Y High Contrast Dark 2 | 3 | This style mimics the a11 light theme from eric bailey's accessible themes. 4 | 5 | ![Screenshot of the a11y-high-contrast-dark theme in a bash script](./images/a11y-high-contrast-dark.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#2b2b2b](https://via.placeholder.com/20/2b2b2b/2b2b2b.png) `#2b2b2b` 10 | 11 | Highlight color: ![#ffd9002e](https://via.placeholder.com/20/ffd9002e/ffd9002e.png) `#ffd9002e` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#ffd900](../../a11y_pygments/assets/ffd900.png) | `#ffd900` | 10.2 : 1 | AAA | AAA | 18 | | ![#ffa07a](../../a11y_pygments/assets/ffa07a.png) | `#ffa07a` | 7.1 : 1 | AAA | AAA | 19 | | ![#abe338](../../a11y_pygments/assets/abe338.png) | `#abe338` | 9.3 : 1 | AAA | AAA | 20 | | ![#00e0e0](../../a11y_pygments/assets/00e0e0.png) | `#00e0e0` | 8.6 : 1 | AAA | AAA | 21 | | ![#dcc6e0](../../a11y_pygments/assets/dcc6e0.png) | `#dcc6e0` | 8.9 : 1 | AAA | AAA | 22 | | ![#f8f8f2](../../a11y_pygments/assets/f8f8f2.png) | `#f8f8f2` | 13.3 : 1 | AAA | AAA | 23 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_dark/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_high_contrast_dark/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_dark/images/a11y-high-contrast-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_high_contrast_dark/images/a11y-high-contrast-dark.png -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_dark/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#ffd900" 20 | red = "#ffa07a" 21 | orange = "#ffd900" 22 | yellow = "#ffd900" 23 | green = "#abe338" 24 | blue = "#00e0e0" 25 | purple = "#dcc6e0" 26 | black = "#f8f8f2" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style mimics the a11 light theme from eric bailey's accessible themes. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#2b2b2b" 37 | highlight_color = "#ffd9002e" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.red, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.comment, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.purple, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.orange, # class: 'kt' 51 | Operator: Colors.green, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.black, # class: 'n' 55 | Name.Attribute: Colors.yellow, # class: 'na' 56 | Name.Builtin: Colors.orange, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 58 | Name.Class: Colors.blue, # class: 'nc' 59 | Name.Constant: Colors.blue, # class: 'no' 60 | Name.Decorator: Colors.orange, # class: 'nd' 61 | Name.Entity: Colors.green, # class: 'ni' 62 | Name.Exception: Colors.purple, # class: 'ne' 63 | Name.Function: Colors.blue, # class: 'nf' 64 | Name.Property: Colors.blue, # class: 'py' 65 | Name.Label: Colors.orange, # class: 'nl' 66 | Name.Namespace: Colors.black, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.blue, # class: 'nt' 69 | Name.Variable: Colors.red, # class: 'nv' 70 | Name.Variable.Magic: Colors.orange, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.orange, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.orange, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.green, # class: 's' 83 | String.Backtick: Colors.green, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | # String.Escape: "", # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.red, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.blue, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.blue, # class: 'gd', 96 | Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.blue, # class: 'gh' 99 | Generic.Subheading: Colors.blue, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_light/README.md: -------------------------------------------------------------------------------- 1 | # A11Y High Contrast Light 2 | 3 | This style mimics the a11y-light theme (but with more contrast) from eric bailey's accessible themes. 4 | 5 | ![Screenshot of the a11y-high-contrast-light theme in a bash script](./images/a11y-high-contrast-light.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#fefefe](https://via.placeholder.com/20/fefefe/fefefe.png) `#fefefe` 10 | 11 | Highlight color: ![#fae4c2](https://via.placeholder.com/20/fae4c2/fae4c2.png) `#fae4c2` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#515151](../../a11y_pygments/assets/515151.png) | `#515151` | 7.9 : 1 | AAA | AAA | 18 | | ![#a12236](../../a11y_pygments/assets/a12236.png) | `#a12236` | 7.4 : 1 | AAA | AAA | 19 | | ![#7f4707](../../a11y_pygments/assets/7f4707.png) | `#7f4707` | 7.4 : 1 | AAA | AAA | 20 | | ![#912583](../../a11y_pygments/assets/912583.png) | `#912583` | 7.4 : 1 | AAA | AAA | 21 | | ![#00622f](../../a11y_pygments/assets/00622f.png) | `#00622f` | 7.5 : 1 | AAA | AAA | 22 | | ![#005b82](../../a11y_pygments/assets/005b82.png) | `#005b82` | 7.4 : 1 | AAA | AAA | 23 | | ![#6730c5](../../a11y_pygments/assets/6730c5.png) | `#6730c5` | 7.4 : 1 | AAA | AAA | 24 | | ![#080808](../../a11y_pygments/assets/080808.png) | `#080808` | 19.9 : 1 | AAA | AAA | 25 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_light/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_high_contrast_light/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_light/images/a11y-high-contrast-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_high_contrast_light/images/a11y-high-contrast-light.png -------------------------------------------------------------------------------- /a11y_pygments/a11y_high_contrast_light/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#515151" 20 | red = "#a12236" 21 | orange = "#7f4707" 22 | magenta = "#912583" 23 | green = "#00622f" 24 | blue = "#005b82" 25 | purple = "#6730c5" 26 | black = "#080808" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style mimics the a11y-light theme (but with more contrast) from eric bailey's accessible themes. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#fefefe" 37 | highlight_color = "#fae4c2" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.red, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.comment, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.purple, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.orange, # class: 'kt' 51 | Operator: Colors.green, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.black, # class: 'n' 55 | Name.Attribute: Colors.magenta, # class: 'na' 56 | Name.Builtin: Colors.orange, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 58 | Name.Class: Colors.blue, # class: 'nc' 59 | Name.Constant: Colors.blue, # class: 'no' 60 | Name.Decorator: Colors.orange, # class: 'nd' 61 | Name.Entity: Colors.green, # class: 'ni' 62 | Name.Exception: Colors.purple, # class: 'ne' 63 | Name.Function: Colors.blue, # class: 'nf' 64 | Name.Property: Colors.blue, # class: 'py' 65 | Name.Label: Colors.orange, # class: 'nl' 66 | Name.Namespace: Colors.black, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.blue, # class: 'nt' 69 | Name.Variable: Colors.red, # class: 'nv' 70 | Name.Variable.Magic: Colors.orange, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.orange, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.orange, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.green, # class: 's' 83 | String.Backtick: Colors.green, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | # String.Escape: "", # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.red, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.blue, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.blue, # class: 'gd', 96 | Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.blue, # class: 'gh' 99 | Generic.Subheading: Colors.blue, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_light/README.md: -------------------------------------------------------------------------------- 1 | # A11Y Light 2 | 3 | This style inspired by the a11y-light theme from eric bailey's accessible themes. 4 | 5 | ![Screenshot of the a11y-light theme in a bash script](./images/a11y-light.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#f2f2f2](https://via.placeholder.com/20/f2f2f2/f2f2f2.png) `#f2f2f2` 10 | 11 | Highlight color: ![#fdf2e2](https://via.placeholder.com/20/fdf2e2/fdf2e2.png) `#fdf2e2` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#515151](../../a11y_pygments/assets/515151.png) | `#515151` | 7.1 : 1 | AAA | AAA | 18 | | ![#d71835](../../a11y_pygments/assets/d71835.png) | `#d71835` | 4.6 : 1 | AA | AAA | 19 | | ![#7f4707](../../a11y_pygments/assets/7f4707.png) | `#7f4707` | 6.7 : 1 | AA | AAA | 20 | | ![#116633](../../a11y_pygments/assets/116633.png) | `#116633` | 6.3 : 1 | AA | AAA | 21 | | ![#00749c](../../a11y_pygments/assets/00749c.png) | `#00749c` | 4.7 : 1 | AA | AAA | 22 | | ![#8045e5](../../a11y_pygments/assets/8045e5.png) | `#8045e5` | 4.8 : 1 | AA | AAA | 23 | | ![#1e1e1e](../../a11y_pygments/assets/1e1e1e.png) | `#1e1e1e` | 14.9 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/a11y_light/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_light/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/a11y_light/images/a11y-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/a11y_light/images/a11y-light.png -------------------------------------------------------------------------------- /a11y_pygments/a11y_light/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#515151" 20 | red = "#d71835" 21 | orange = "#7f4707" 22 | yellow = "#7f4707" 23 | green = "#116633" 24 | blue = "#00749c" 25 | purple = "#8045e5" 26 | black = "#1e1e1e" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style inspired by the a11y-light theme from eric bailey's accessible themes. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#f2f2f2" 37 | highlight_color = "#fdf2e2" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.red, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.comment, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.purple, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.orange, # class: 'kt' 51 | Operator: Colors.green, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.black, # class: 'n' 55 | Name.Attribute: Colors.yellow, # class: 'na' 56 | Name.Builtin: Colors.orange, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 58 | Name.Class: Colors.blue, # class: 'nc' 59 | Name.Constant: Colors.blue, # class: 'no' 60 | Name.Decorator: Colors.orange, # class: 'nd' 61 | Name.Entity: Colors.green, # class: 'ni' 62 | Name.Exception: Colors.purple, # class: 'ne' 63 | Name.Function: Colors.blue, # class: 'nf' 64 | Name.Property: Colors.blue, # class: 'py' 65 | Name.Label: Colors.orange, # class: 'nl' 66 | Name.Namespace: Colors.black, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.blue, # class: 'nt' 69 | Name.Variable: Colors.red, # class: 'nv' 70 | Name.Variable.Magic: Colors.orange, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.orange, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.orange, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.green, # class: 's' 83 | String.Backtick: Colors.green, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | # String.Escape: "", # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.red, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.blue, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.blue, # class: 'gd', 96 | Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.blue, # class: 'gh' 99 | Generic.Subheading: Colors.blue, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/assets/000000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/000000.png -------------------------------------------------------------------------------- /a11y_pygments/assets/005b82.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/005b82.png -------------------------------------------------------------------------------- /a11y_pygments/assets/00622f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/00622f.png -------------------------------------------------------------------------------- /a11y_pygments/assets/0072b2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/0072b2.png -------------------------------------------------------------------------------- /a11y_pygments/assets/00749c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/00749c.png -------------------------------------------------------------------------------- /a11y_pygments/assets/008561.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/008561.png -------------------------------------------------------------------------------- /a11y_pygments/assets/00e0e0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/00e0e0.png -------------------------------------------------------------------------------- /a11y_pygments/assets/023b95.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/023b95.png -------------------------------------------------------------------------------- /a11y_pygments/assets/024c1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/024c1a.png -------------------------------------------------------------------------------- /a11y_pygments/assets/0550ae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/0550ae.png -------------------------------------------------------------------------------- /a11y_pygments/assets/080808.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/080808.png -------------------------------------------------------------------------------- /a11y_pygments/assets/116329.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/116329.png -------------------------------------------------------------------------------- /a11y_pygments/assets/116633.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/116633.png -------------------------------------------------------------------------------- /a11y_pygments/assets/141414.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/141414.png -------------------------------------------------------------------------------- /a11y_pygments/assets/18c1c4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/18c1c4.png -------------------------------------------------------------------------------- /a11y_pygments/assets/1e1e1e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/1e1e1e.png -------------------------------------------------------------------------------- /a11y_pygments/assets/24292f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/24292f.png -------------------------------------------------------------------------------- /a11y_pygments/assets/3d73a9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/3d73a9.png -------------------------------------------------------------------------------- /a11y_pygments/assets/437a6b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/437a6b.png -------------------------------------------------------------------------------- /a11y_pygments/assets/515151.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/515151.png -------------------------------------------------------------------------------- /a11y_pygments/assets/5391cf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/5391cf.png -------------------------------------------------------------------------------- /a11y_pygments/assets/5ca7e4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/5ca7e4.png -------------------------------------------------------------------------------- /a11y_pygments/assets/622cbc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/622cbc.png -------------------------------------------------------------------------------- /a11y_pygments/assets/66707b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/66707b.png -------------------------------------------------------------------------------- /a11y_pygments/assets/66ccee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/66ccee.png -------------------------------------------------------------------------------- /a11y_pygments/assets/66e9ec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/66e9ec.png -------------------------------------------------------------------------------- /a11y_pygments/assets/6730c5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/6730c5.png -------------------------------------------------------------------------------- /a11y_pygments/assets/6e7781.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/6e7781.png -------------------------------------------------------------------------------- /a11y_pygments/assets/6f98b3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/6f98b3.png -------------------------------------------------------------------------------- /a11y_pygments/assets/702c00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/702c00.png -------------------------------------------------------------------------------- /a11y_pygments/assets/72f088.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/72f088.png -------------------------------------------------------------------------------- /a11y_pygments/assets/737373.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/737373.png -------------------------------------------------------------------------------- /a11y_pygments/assets/797979.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/797979.png -------------------------------------------------------------------------------- /a11y_pygments/assets/7998f2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/7998f2.png -------------------------------------------------------------------------------- /a11y_pygments/assets/79c0ff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/79c0ff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/7ee787.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/7ee787.png -------------------------------------------------------------------------------- /a11y_pygments/assets/7f4707.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/7f4707.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8045e5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8045e5.png -------------------------------------------------------------------------------- /a11y_pygments/assets/81b19b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/81b19b.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8250df.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8250df.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8786ac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8786ac.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8a4600.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8a4600.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8b949e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8b949e.png -------------------------------------------------------------------------------- /a11y_pygments/assets/8c8c8c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/8c8c8c.png -------------------------------------------------------------------------------- /a11y_pygments/assets/912583.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/912583.png -------------------------------------------------------------------------------- /a11y_pygments/assets/91cbff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/91cbff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/953800.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/953800.png -------------------------------------------------------------------------------- /a11y_pygments/assets/974eb7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/974eb7.png -------------------------------------------------------------------------------- /a11y_pygments/assets/98661b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/98661b.png -------------------------------------------------------------------------------- /a11y_pygments/assets/996b00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/996b00.png -------------------------------------------------------------------------------- /a11y_pygments/assets/9e86c8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/9e86c8.png -------------------------------------------------------------------------------- /a11y_pygments/assets/9e8741.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/9e8741.png -------------------------------------------------------------------------------- /a11y_pygments/assets/9f4e55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/9f4e55.png -------------------------------------------------------------------------------- /a11y_pygments/assets/a0111f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/a0111f.png -------------------------------------------------------------------------------- /a11y_pygments/assets/a12236.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/a12236.png -------------------------------------------------------------------------------- /a11y_pygments/assets/a25e53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/a25e53.png -------------------------------------------------------------------------------- /a11y_pygments/assets/a2bffc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/a2bffc.png -------------------------------------------------------------------------------- /a11y_pygments/assets/a5d6ff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/a5d6ff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ab6369.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ab6369.png -------------------------------------------------------------------------------- /a11y_pygments/assets/abe338.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/abe338.png -------------------------------------------------------------------------------- /a11y_pygments/assets/b19db4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/b19db4.png -------------------------------------------------------------------------------- /a11y_pygments/assets/b1bac4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/b1bac4.png -------------------------------------------------------------------------------- /a11y_pygments/assets/b35900.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/b35900.png -------------------------------------------------------------------------------- /a11y_pygments/assets/b89784.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/b89784.png -------------------------------------------------------------------------------- /a11y_pygments/assets/bbbbbb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/bbbbbb.png -------------------------------------------------------------------------------- /a11y_pygments/assets/bf5400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/bf5400.png -------------------------------------------------------------------------------- /a11y_pygments/assets/c4a2f5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/c4a2f5.png -------------------------------------------------------------------------------- /a11y_pygments/assets/c5e478.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/c5e478.png -------------------------------------------------------------------------------- /a11y_pygments/assets/c9d1d9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/c9d1d9.png -------------------------------------------------------------------------------- /a11y_pygments/assets/caab6d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/caab6d.png -------------------------------------------------------------------------------- /a11y_pygments/assets/cc398b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/cc398b.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ccbb44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ccbb44.png -------------------------------------------------------------------------------- /a11y_pygments/assets/cf222e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/cf222e.png -------------------------------------------------------------------------------- /a11y_pygments/assets/d166a3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/d166a3.png -------------------------------------------------------------------------------- /a11y_pygments/assets/d2a8ff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/d2a8ff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/d4d0ab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/d4d0ab.png -------------------------------------------------------------------------------- /a11y_pygments/assets/d71835.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/d71835.png -------------------------------------------------------------------------------- /a11y_pygments/assets/d9dee3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/d9dee3.png -------------------------------------------------------------------------------- /a11y_pygments/assets/dbb7ff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/dbb7ff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/dcc6e0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/dcc6e0.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ec8e2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ec8e2c.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ee6677.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ee6677.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f26196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f26196.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f5a394.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f5a394.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f5ab35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f5ab35.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f5f5f5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f5f5f5.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f78c6c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f78c6c.png -------------------------------------------------------------------------------- /a11y_pygments/assets/f8f8f2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/f8f8f2.png -------------------------------------------------------------------------------- /a11y_pygments/assets/fad000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/fad000.png -------------------------------------------------------------------------------- /a11y_pygments/assets/fdac54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/fdac54.png -------------------------------------------------------------------------------- /a11y_pygments/assets/fefeff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/fefeff.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ff7b72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ff7b72.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ff9492.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ff9492.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ffa07a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ffa07a.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ffa657.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ffa657.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ffb757.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ffb757.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ffd700.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ffd700.png -------------------------------------------------------------------------------- /a11y_pygments/assets/ffd900.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/assets/ffd900.png -------------------------------------------------------------------------------- /a11y_pygments/blinds_dark/README.md: -------------------------------------------------------------------------------- 1 | # Blinds Dark 2 | 3 | This style mimics the blinds dark theme from vscode themes. 4 | 5 | ![Screenshot of the blinds-dark theme in a bash script](./images/blinds-dark.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#242424](https://via.placeholder.com/20/242424/242424.png) `#242424` 10 | 11 | Highlight color: ![#66666691](https://via.placeholder.com/20/66666691/66666691.png) `#66666691` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | ------- | ----------- | ---------- | 17 | | ![#8c8c8c](../../a11y_pygments/assets/8c8c8c.png) | `#8c8c8c` | 4.6 : 1 | AA | AAA | 18 | | ![#ee6677](../../a11y_pygments/assets/ee6677.png) | `#ee6677` | 5.0 : 1 | AA | AAA | 19 | | ![#ccbb44](../../a11y_pygments/assets/ccbb44.png) | `#ccbb44` | 8.0 : 1 | AAA | AAA | 20 | | ![#66ccee](../../a11y_pygments/assets/66ccee.png) | `#66ccee` | 8.5 : 1 | AAA | AAA | 21 | | ![#5391cf](../../a11y_pygments/assets/5391cf.png) | `#5391cf` | 4.7 : 1 | AA | AAA | 22 | | ![#d166a3](../../a11y_pygments/assets/d166a3.png) | `#d166a3` | 4.5 : 1 | AA | AAA | 23 | | ![#bbbbbb](../../a11y_pygments/assets/bbbbbb.png) | `#bbbbbb` | 8.1 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/blinds_dark/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/blinds_dark/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/blinds_dark/images/blinds-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/blinds_dark/images/blinds-dark.png -------------------------------------------------------------------------------- /a11y_pygments/blinds_dark/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#8C8C8C" 20 | orange = "#ee6677" 21 | yellow = "#ccbb44" 22 | green = "#66ccee" 23 | blue = "#5391CF" 24 | purple = "#D166A3" 25 | black = "#bbbbbb" 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the blinds dark theme from vscode themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#242424" 36 | highlight_color = "#66666691" 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.blue, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.purple, # class: 'k' ##### 44 | Keyword.Constant: Colors.purple, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.green, # class: 'kt' 50 | Operator: Colors.orange, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.blue, # class: 'n' 54 | Name.Attribute: Colors.purple, # class: 'na' 55 | Name.Builtin: Colors.green, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.green, # class: 'bp' 57 | Name.Class: Colors.orange, # class: 'nc' 58 | Name.Constant: Colors.orange, # class: 'no' 59 | Name.Decorator: Colors.yellow, # class: 'nd' 60 | Name.Entity: Colors.yellow, # class: 'ni' 61 | Name.Exception: Colors.blue, # class: 'ne' 62 | Name.Function: Colors.green, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.green, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.blue, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.black, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.blue, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.purple, # class: 's' 82 | # String.Backtick: Colors.green, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.purple, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.orange, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | # Generic.Error: "", # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/blinds_light/README.md: -------------------------------------------------------------------------------- 1 | # Blinds Light 2 | 3 | This style mimics the blinds light theme from vscode themes. 4 | 5 | ![Screenshot of the blinds-light theme in a bash script](./images/blinds-light.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#fcfcfc](https://via.placeholder.com/20/fcfcfc/fcfcfc.png) `#fcfcfc` 10 | 11 | Highlight color: ![#add6ff](https://via.placeholder.com/20/add6ff/add6ff.png) `#add6ff` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#737373](../../a11y_pygments/assets/737373.png) | `#737373` | 4.6 : 1 | AA | AAA | 18 | | ![#bf5400](../../a11y_pygments/assets/bf5400.png) | `#bf5400` | 4.6 : 1 | AA | AAA | 19 | | ![#996b00](../../a11y_pygments/assets/996b00.png) | `#996b00` | 4.6 : 1 | AA | AAA | 20 | | ![#008561](../../a11y_pygments/assets/008561.png) | `#008561` | 4.5 : 1 | AA | AAA | 21 | | ![#0072b2](../../a11y_pygments/assets/0072b2.png) | `#0072b2` | 5.1 : 1 | AA | AAA | 22 | | ![#cc398b](../../a11y_pygments/assets/cc398b.png) | `#cc398b` | 4.5 : 1 | AA | AAA | 23 | | ![#000000](../../a11y_pygments/assets/000000.png) | `#000000` | 20.5 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/blinds_light/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/blinds_light/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/blinds_light/images/blinds-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/blinds_light/images/blinds-light.png -------------------------------------------------------------------------------- /a11y_pygments/blinds_light/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#737373" 20 | orange = "#BF5400" 21 | yellow = "#996B00" 22 | green = "#008561" 23 | blue = "#0072b2" 24 | purple = "#CC398B" 25 | black = "#000000" 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the blinds light theme from vscode themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#fcfcfc" 36 | highlight_color = "#add6ff" 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.blue, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.purple, # class: 'k' ##### 44 | Keyword.Constant: Colors.purple, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.green, # class: 'kt' 50 | Operator: Colors.orange, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.blue, # class: 'n' 54 | Name.Attribute: Colors.purple, # class: 'na' 55 | Name.Builtin: Colors.green, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.green, # class: 'bp' 57 | Name.Class: Colors.orange, # class: 'nc' 58 | Name.Constant: Colors.orange, # class: 'no' 59 | Name.Decorator: Colors.yellow, # class: 'nd' 60 | Name.Entity: Colors.blue, # class: 'ni' 61 | Name.Exception: Colors.blue, # class: 'ne' 62 | Name.Function: Colors.green, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.green, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.blue, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.black, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.blue, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.purple, # class: 's' 82 | # String.Backtick: Colors.green, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.purple, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.orange, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | # Generic.Error: "", # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark/README.md: -------------------------------------------------------------------------------- 1 | # Github Dark 2 | 3 | This style mimics the github dark default theme from vs code themes. 4 | 5 | ![Screenshot of the github-dark theme in a bash script](./images/github-dark.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#0d1117](https://via.placeholder.com/20/0d1117/0d1117.png) `#0d1117` 10 | 11 | Highlight color: ![#6e7681](https://via.placeholder.com/20/6e7681/6e7681.png) `#6e7681` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#8b949e](../../a11y_pygments/assets/8b949e.png) | `#8b949e` | 6.2 : 1 | AA | AAA | 18 | | ![#ff7b72](../../a11y_pygments/assets/ff7b72.png) | `#ff7b72` | 7.5 : 1 | AAA | AAA | 19 | | ![#ffa657](../../a11y_pygments/assets/ffa657.png) | `#ffa657` | 9.8 : 1 | AAA | AAA | 20 | | ![#7ee787](../../a11y_pygments/assets/7ee787.png) | `#7ee787` | 12.3 : 1 | AAA | AAA | 21 | | ![#79c0ff](../../a11y_pygments/assets/79c0ff.png) | `#79c0ff` | 9.7 : 1 | AAA | AAA | 22 | | ![#d2a8ff](../../a11y_pygments/assets/d2a8ff.png) | `#d2a8ff` | 9.7 : 1 | AAA | AAA | 23 | | ![#c9d1d9](../../a11y_pygments/assets/c9d1d9.png) | `#c9d1d9` | 12.3 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_dark/images/github-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark/images/github-dark.png -------------------------------------------------------------------------------- /a11y_pygments/github_dark/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#8b949e" # grey[2] 20 | red = "#ff7b72" # red[3] 21 | orange = "#ffa657" # orange[2] 22 | green = "#7ee787" # green[1] 23 | blue = "#79c0ff" # blue[2] 24 | purple = "#d2a8ff" # purple[2] 25 | black = "#C9D1D9" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github dark default theme from vs code themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#0d1117" # canvas.default 36 | highlight_color = "#6e768182" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark_colorblind/README.md: -------------------------------------------------------------------------------- 1 | # Github Dark Colorblind 2 | 3 | This style mimics the github dark colorblind theme from vscode. 4 | 5 | ![Screenshot of the github-dark-colorblind theme in a bash script](./images/github-dark-colorblind.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#0d1117](https://via.placeholder.com/20/0d1117/0d1117.png) `#0d1117` 10 | 11 | Highlight color: ![#58a6ff70](https://via.placeholder.com/20/58a6ff70/58a6ff70.png) `#58a6ff70` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#b1bac4](../../a11y_pygments/assets/b1bac4.png) | `#b1bac4` | 9.6 : 1 | AAA | AAA | 18 | | ![#ec8e2c](../../a11y_pygments/assets/ec8e2c.png) | `#ec8e2c` | 7.6 : 1 | AAA | AAA | 19 | | ![#fdac54](../../a11y_pygments/assets/fdac54.png) | `#fdac54` | 10.1 : 1 | AAA | AAA | 20 | | ![#a5d6ff](../../a11y_pygments/assets/a5d6ff.png) | `#a5d6ff` | 12.3 : 1 | AAA | AAA | 21 | | ![#79c0ff](../../a11y_pygments/assets/79c0ff.png) | `#79c0ff` | 9.7 : 1 | AAA | AAA | 22 | | ![#d2a8ff](../../a11y_pygments/assets/d2a8ff.png) | `#d2a8ff` | 9.7 : 1 | AAA | AAA | 23 | | ![#c9d1d9](../../a11y_pygments/assets/c9d1d9.png) | `#c9d1d9` | 12.3 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark_colorblind/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark_colorblind/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_dark_colorblind/images/github-dark-colorblind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark_colorblind/images/github-dark-colorblind.png -------------------------------------------------------------------------------- /a11y_pygments/github_dark_colorblind/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#b1bac4" # grey[2] 20 | red = "#ec8e2c" # red[3] 21 | orange = "#fdac54" # orange[2] 22 | green = "#a5d6ff" # green[1] 23 | blue = "#79c0ff" # blue[2] 24 | purple = "#d2a8ff" # purple[2] 25 | black = "#C9D1D9" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github dark colorblind theme from vscode. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#0d1117" # canvas.default 36 | highlight_color = "#58a6ff70" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark_high_contrast/README.md: -------------------------------------------------------------------------------- 1 | # Github Dark High Contrast 2 | 3 | This style mimics the github dark high contrast theme from vs code themes. 4 | 5 | ![Screenshot of the github-dark-high-contrast theme in a bash script](./images/github-dark-high-contrast.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#0d1117](https://via.placeholder.com/20/0d1117/0d1117.png) `#0d1117` 10 | 11 | Highlight color: ![#58a6ff70](https://via.placeholder.com/20/58a6ff70/58a6ff70.png) `#58a6ff70` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#d9dee3](../../a11y_pygments/assets/d9dee3.png) | `#d9dee3` | 14.0 : 1 | AAA | AAA | 18 | | ![#ff9492](../../a11y_pygments/assets/ff9492.png) | `#ff9492` | 8.9 : 1 | AAA | AAA | 19 | | ![#ffb757](../../a11y_pygments/assets/ffb757.png) | `#ffb757` | 11.0 : 1 | AAA | AAA | 20 | | ![#72f088](../../a11y_pygments/assets/72f088.png) | `#72f088` | 13.1 : 1 | AAA | AAA | 21 | | ![#91cbff](../../a11y_pygments/assets/91cbff.png) | `#91cbff` | 11.0 : 1 | AAA | AAA | 22 | | ![#dbb7ff](../../a11y_pygments/assets/dbb7ff.png) | `#dbb7ff` | 11.0 : 1 | AAA | AAA | 23 | | ![#c9d1d9](../../a11y_pygments/assets/c9d1d9.png) | `#c9d1d9` | 12.3 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/github_dark_high_contrast/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark_high_contrast/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_dark_high_contrast/images/github-dark-high-contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_dark_high_contrast/images/github-dark-high-contrast.png -------------------------------------------------------------------------------- /a11y_pygments/github_dark_high_contrast/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#d9dee3" # grey[2] 20 | red = "#ff9492" # red[3] 21 | orange = "#ffb757" # orange[2] 22 | green = "#72f088" # green[1] 23 | blue = "#91cbff" # blue[2] 24 | purple = "#dbb7ff" # purple[2] 25 | black = "#C9D1D9" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github dark high contrast theme from vs code themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#0d1117" # canvas.default 36 | highlight_color = "#58a6ff70" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_light/README.md: -------------------------------------------------------------------------------- 1 | # Github Light 2 | 3 | This style mimics the github light theme from vscode themes. 4 | 5 | ![Screenshot of the github-light theme in a bash script](./images/github-light.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#ffffff](https://via.placeholder.com/20/ffffff/ffffff.png) `#ffffff` 10 | 11 | Highlight color: ![#0969da4a](https://via.placeholder.com/20/0969da4a/0969da4a.png) `#0969da4a` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#6e7781](../../a11y_pygments/assets/6e7781.png) | `#6e7781` | 4.5 : 1 | AA | AAA | 18 | | ![#cf222e](../../a11y_pygments/assets/cf222e.png) | `#cf222e` | 5.4 : 1 | AA | AAA | 19 | | ![#953800](../../a11y_pygments/assets/953800.png) | `#953800` | 7.4 : 1 | AAA | AAA | 20 | | ![#116329](../../a11y_pygments/assets/116329.png) | `#116329` | 7.4 : 1 | AAA | AAA | 21 | | ![#0550ae](../../a11y_pygments/assets/0550ae.png) | `#0550ae` | 7.6 : 1 | AAA | AAA | 22 | | ![#8250df](../../a11y_pygments/assets/8250df.png) | `#8250df` | 5.0 : 1 | AA | AAA | 23 | | ![#24292f](../../a11y_pygments/assets/24292f.png) | `#24292f` | 14.7 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/github_light/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_light/images/github-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light/images/github-light.png -------------------------------------------------------------------------------- /a11y_pygments/github_light/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#6e7781" # grey[5] 20 | red = "#cf222e" # red[5] 21 | orange = "#953800" # orange[6] 22 | green = "#116329" # green[6] 23 | blue = "#0550ae" # blue[6] 24 | purple = "#8250df" # purple[5] 25 | black = "#24292f" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github light theme from vscode themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#ffffff" # canvas.default 36 | highlight_color = "#0969da4a" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_light_colorblind/README.md: -------------------------------------------------------------------------------- 1 | # Github Light Colorblind 2 | 3 | This style mimics the github light colorblind theme from vscode themes. 4 | 5 | ![Screenshot of the github-light-colorblind theme in a bash script](./images/github-light-colorblind.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#ffffff](https://via.placeholder.com/20/ffffff/ffffff.png) `#ffffff` 10 | 11 | Highlight color: ![#0969da4a](https://via.placeholder.com/20/0969da4a/0969da4a.png) `#0969da4a` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#6e7781](../../a11y_pygments/assets/6e7781.png) | `#6e7781` | 4.5 : 1 | AA | AAA | 18 | | ![#b35900](../../a11y_pygments/assets/b35900.png) | `#b35900` | 4.8 : 1 | AA | AAA | 19 | | ![#8a4600](../../a11y_pygments/assets/8a4600.png) | `#8a4600` | 7.1 : 1 | AAA | AAA | 20 | | ![#0550ae](../../a11y_pygments/assets/0550ae.png) | `#0550ae` | 7.6 : 1 | AAA | AAA | 21 | | ![#8250df](../../a11y_pygments/assets/8250df.png) | `#8250df` | 5.0 : 1 | AA | AAA | 22 | | ![#24292f](../../a11y_pygments/assets/24292f.png) | `#24292f` | 14.7 : 1 | AAA | AAA | 23 | -------------------------------------------------------------------------------- /a11y_pygments/github_light_colorblind/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light_colorblind/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_light_colorblind/images/github-light-colorblind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light_colorblind/images/github-light-colorblind.png -------------------------------------------------------------------------------- /a11y_pygments/github_light_colorblind/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#6e7781" # grey[5] 20 | red = "#b35900" # red[5] 21 | orange = "#8a4600" # orange[6] 22 | green = "#0550ae" # green[6] 23 | blue = "#0550ae" # blue[6] 24 | purple = "#8250df" # purple[5] 25 | black = "#24292f" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github light colorblind theme from vscode themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#ffffff" # canvas.default 36 | highlight_color = "#0969da4a" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/github_light_high_contrast/README.md: -------------------------------------------------------------------------------- 1 | # Github Light High Contrast 2 | 3 | This style mimics the github light high contrast theme from vscode themes. 4 | 5 | ![Screenshot of the github-light-high-contrast theme in a bash script](./images/github-light-high-contrast.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#ffffff](https://via.placeholder.com/20/ffffff/ffffff.png) `#ffffff` 10 | 11 | Highlight color: ![#0969da4a](https://via.placeholder.com/20/0969da4a/0969da4a.png) `#0969da4a` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#66707b](../../a11y_pygments/assets/66707b.png) | `#66707b` | 5.0 : 1 | AA | AAA | 18 | | ![#a0111f](../../a11y_pygments/assets/a0111f.png) | `#a0111f` | 8.1 : 1 | AAA | AAA | 19 | | ![#702c00](../../a11y_pygments/assets/702c00.png) | `#702c00` | 10.2 : 1 | AAA | AAA | 20 | | ![#024c1a](../../a11y_pygments/assets/024c1a.png) | `#024c1a` | 10.2 : 1 | AAA | AAA | 21 | | ![#023b95](../../a11y_pygments/assets/023b95.png) | `#023b95` | 10.2 : 1 | AAA | AAA | 22 | | ![#622cbc](../../a11y_pygments/assets/622cbc.png) | `#622cbc` | 8.1 : 1 | AAA | AAA | 23 | | ![#24292f](../../a11y_pygments/assets/24292f.png) | `#24292f` | 14.7 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/github_light_high_contrast/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light_high_contrast/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/github_light_high_contrast/images/github-light-high-contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/github_light_high_contrast/images/github-light-high-contrast.png -------------------------------------------------------------------------------- /a11y_pygments/github_light_high_contrast/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#66707b" # grey[5] 20 | red = "#a0111f" # red[5] 21 | orange = "#702c00" # orange[6] 22 | green = "#024c1a" # green[6] 23 | blue = "#023b95" # blue[6] 24 | purple = "#622cbc" # purple[5] 25 | black = "#24292f" # fg.default 26 | 27 | 28 | class Theme(Style): 29 | """ 30 | This style mimics the github light high contrast theme from vscode themes. 31 | """ 32 | 33 | default_style = "" 34 | 35 | background_color = "#ffffff" # canvas.default 36 | highlight_color = "#0969da4a" # accent.fg 37 | 38 | styles = { 39 | Text: Colors.black, # class: '' 40 | Error: Colors.red, # class: 'err' 41 | Other: "", # class 'x' 42 | Comment: Colors.comment, # class: 'c' 43 | Keyword: Colors.red, # class: 'k' 44 | Keyword.Constant: Colors.blue, # class: 'kc' 45 | # Keyword.Declaration: "", # class: 'kd' 46 | # Keyword.Namespace: "", # class: 'kn' 47 | # Keyword.Pseudo: "", # class: 'kp' 48 | # Keyword.Reserved: "", # class: 'kr' 49 | Keyword.Type: Colors.red, # class: 'kt' 50 | Operator: Colors.green, # class: 'o' 51 | Operator.Word: Colors.purple, # class: 'ow' 52 | Punctuation: Colors.black, # class: 'p' 53 | Name: Colors.purple, # class: 'n' 54 | Name.Attribute: Colors.orange, # class: 'na' 55 | Name.Builtin: Colors.orange, # class: 'nb' 56 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 57 | Name.Class: Colors.blue, # class: 'nc' 58 | Name.Constant: Colors.blue, # class: 'no' 59 | Name.Decorator: Colors.orange, # class: 'nd' 60 | Name.Entity: Colors.green, # class: 'ni' 61 | Name.Exception: Colors.purple, # class: 'ne' 62 | Name.Function: Colors.blue, # class: 'nf' 63 | Name.Property: Colors.blue, # class: 'py' 64 | Name.Label: Colors.orange, # class: 'nl' 65 | Name.Namespace: Colors.black, # class: 'nn' 66 | # Name.Other: "", # class: 'nx' 67 | Name.Tag: Colors.green, # class: 'nt' 68 | Name.Variable: Colors.orange, # class: 'nv' 69 | Name.Variable.Magic: Colors.orange, 70 | # Name.Variable.Class: "", # class: 'vc' 71 | # Name.Variable.Global: "", # class: 'vg' 72 | # Name.Variable.Instance: "", # class: 'vi' 73 | Number: Colors.orange, # class: 'm' 74 | # Number.Float: "", # class: 'mf' 75 | # Number.Hex: "", # class: 'mh' 76 | # Number.Integer: "", # class: 'mi' 77 | # Number.Integer.Long: "", # class: 'il' 78 | # Number.Oct: "", # class: 'mo' 79 | Literal: Colors.orange, # class: 'l' 80 | # Literal.Date: "", # class: 'ld' 81 | String: Colors.blue, # class: 's' 82 | String.Backtick: Colors.blue, # class: 'sb' 83 | # String.Char: "", # class: 'sc' 84 | # String.Doc: "", # class: 'sd' 85 | # String.Double: "", # class: 's2' 86 | # String.Escape: "", # class: 'se' 87 | # String.Heredoc: "", # class: 'sh' 88 | # String.Interpol: "", # class: 'si' 89 | # String.Other: "", # class: 'sx' 90 | String.Regex: Colors.blue, # class: 'sr' 91 | # String.Single: "", # class: 's1' 92 | String.Symbol: Colors.blue, # class: 'ss' 93 | # Generic: "", # class: 'g' 94 | Generic.Deleted: Colors.blue, # class: 'gd', 95 | Generic.Emph: "italic", # class: 'ge' 96 | Generic.Error: Colors.red, # class: 'gr' 97 | Generic.Heading: Colors.blue, # class: 'gh' 98 | Generic.Subheading: Colors.blue, # class: 'gu' 99 | # Generic.Inserted: "", # class: 'gi' 100 | # Generic.Output: "", # class: 'go' 101 | # Generic.Prompt: "", # class: 'gp' 102 | Generic.Strong: "bold", # class: 'gs' 103 | # Generic.Traceback: "", # class: 'gt' 104 | } 105 | -------------------------------------------------------------------------------- /a11y_pygments/gotthard_dark/README.md: -------------------------------------------------------------------------------- 1 | # Gotthard Dark 2 | 3 | This style mimics the gotthard dark theme from vscode. 4 | 5 | ![Screenshot of the gotthard-dark theme in a bash script](./images/gotthard-dark.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#000000](https://via.placeholder.com/20/000000/000000.png) `#000000` 10 | 11 | Highlight color: ![#4c4b4be8](https://via.placeholder.com/20/4c4b4be8/4c4b4be8.png) `#4c4b4be8` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#f5f5f5](../../a11y_pygments/assets/f5f5f5.png) | `#f5f5f5` | 19.3 : 1 | AAA | AAA | 18 | | ![#ab6369](../../a11y_pygments/assets/ab6369.png) | `#ab6369` | 4.7 : 1 | AA | AAA | 19 | | ![#b89784](../../a11y_pygments/assets/b89784.png) | `#b89784` | 7.8 : 1 | AAA | AAA | 20 | | ![#caab6d](../../a11y_pygments/assets/caab6d.png) | `#caab6d` | 9.6 : 1 | AAA | AAA | 21 | | ![#81b19b](../../a11y_pygments/assets/81b19b.png) | `#81b19b` | 8.7 : 1 | AAA | AAA | 22 | | ![#6f98b3](../../a11y_pygments/assets/6f98b3.png) | `#6f98b3` | 6.8 : 1 | AA | AAA | 23 | | ![#b19db4](../../a11y_pygments/assets/b19db4.png) | `#b19db4` | 8.4 : 1 | AAA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/gotthard_dark/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/gotthard_dark/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/gotthard_dark/images/gotthard-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/gotthard_dark/images/gotthard-dark.png -------------------------------------------------------------------------------- /a11y_pygments/gotthard_dark/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#F5F5F5" 20 | red = "#AB6369" 21 | orange = "#B89784" 22 | yellow = "#CAAB6D" 23 | green = "#81B19B" 24 | blue = "#6F98B3" 25 | purple = "#b19db4" 26 | black = "#F5F5F5" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style mimics the gotthard dark theme from vscode. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#000000" 37 | highlight_color = "#4c4b4be8" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.red, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.purple, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.red, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.green, # class: 'kt' 51 | Operator: Colors.blue, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.black, # class: 'n' 55 | Name.Attribute: Colors.purple, # class: 'na' 56 | Name.Builtin: Colors.green, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.green, # class: 'bp' 58 | Name.Class: Colors.yellow, # class: 'nc' 59 | Name.Constant: Colors.red, # class: 'no' 60 | Name.Decorator: Colors.green, # class: 'nd' 61 | Name.Entity: Colors.green, # class: 'ni' 62 | Name.Exception: Colors.red, # class: 'ne' 63 | Name.Function: Colors.purple, # class: 'nf' 64 | Name.Property: Colors.purple, # class: 'py' 65 | Name.Label: Colors.green, # class: 'nl' 66 | Name.Namespace: Colors.yellow, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.red, # class: 'nt' 69 | Name.Variable: Colors.comment, # class: 'nv' 70 | Name.Variable.Magic: Colors.comment, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.red, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.purple, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.green, # class: 's' 83 | String.Backtick: Colors.yellow, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | String.Escape: Colors.blue, # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.blue, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.green, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.red, # class: 'gd', 96 | # Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.green, # class: 'gh' 99 | Generic.Subheading: Colors.green, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/gotthard_light/README.md: -------------------------------------------------------------------------------- 1 | # Gotthard Light 2 | 3 | This style mimics the gotthard light theme from vscode. 4 | 5 | ![Screenshot of the gotthard-light theme in a bash script](./images/gotthard-light.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#F5F5F5](https://via.placeholder.com/20/F5F5F5/F5F5F5.png) `#F5F5F5` 10 | 11 | Highlight color: ![#E1E1E1](https://via.placeholder.com/20/E1E1E1/E1E1E1.png) `#E1E1E1` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#141414](../../a11y_pygments/assets/141414.png) | `#141414` | 16.9 : 1 | AAA | AAA | 18 | | ![#9f4e55](../../a11y_pygments/assets/9f4e55.png) | `#9f4e55` | 5.2 : 1 | AA | AAA | 19 | | ![#a25e53](../../a11y_pygments/assets/a25e53.png) | `#a25e53` | 4.5 : 1 | AA | AAA | 20 | | ![#98661b](../../a11y_pygments/assets/98661b.png) | `#98661b` | 4.5 : 1 | AA | AAA | 21 | | ![#437a6b](../../a11y_pygments/assets/437a6b.png) | `#437a6b` | 4.5 : 1 | AA | AAA | 22 | | ![#3d73a9](../../a11y_pygments/assets/3d73a9.png) | `#3d73a9` | 4.6 : 1 | AA | AAA | 23 | | ![#974eb7](../../a11y_pygments/assets/974eb7.png) | `#974eb7` | 4.7 : 1 | AA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/gotthard_light/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/gotthard_light/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/gotthard_light/images/gotthard-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/gotthard_light/images/gotthard-light.png -------------------------------------------------------------------------------- /a11y_pygments/gotthard_light/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#141414" 20 | red = "#9F4E55" 21 | orange = "#A25E53" 22 | yellow = "#98661B" 23 | green = "#437A6B" 24 | blue = "#3D73A9" 25 | purple = "#974EB7" 26 | black = "#141414" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style mimics the gotthard light theme from vscode. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#F5F5F5" 37 | highlight_color = "#E1E1E1" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.red, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.purple, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.red, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.green, # class: 'kt' 51 | Operator: Colors.blue, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.black, # class: 'n' 55 | Name.Attribute: Colors.purple, # class: 'na' 56 | Name.Builtin: Colors.green, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.green, # class: 'bp' 58 | Name.Class: Colors.yellow, # class: 'nc' 59 | Name.Constant: Colors.red, # class: 'no' 60 | Name.Decorator: Colors.green, # class: 'nd' 61 | Name.Entity: Colors.green, # class: 'ni' 62 | Name.Exception: Colors.red, # class: 'ne' 63 | Name.Function: Colors.purple, # class: 'nf' 64 | Name.Property: Colors.purple, # class: 'py' 65 | Name.Label: Colors.green, # class: 'nl' 66 | Name.Namespace: Colors.yellow, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.red, # class: 'nt' 69 | Name.Variable: Colors.comment, # class: 'nv' 70 | Name.Variable.Magic: Colors.comment, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.red, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.purple, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.green, # class: 's' 83 | String.Backtick: Colors.yellow, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | String.Escape: Colors.blue, # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.blue, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.green, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.red, # class: 'gd', 96 | # Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.green, # class: 'gh' 99 | Generic.Subheading: Colors.green, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/greative/README.md: -------------------------------------------------------------------------------- 1 | # Greative 2 | 3 | This style mimics greative theme from vscode themes. 4 | 5 | ![Screenshot of the greative theme in a bash script](./images/greative.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#010726](https://via.placeholder.com/20/010726/010726.png) `#010726` 10 | 11 | Highlight color: ![#473d18](https://via.placeholder.com/20/473d18/473d18.png) `#473d18` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#797979](../../a11y_pygments/assets/797979.png) | `#797979` | 4.6 : 1 | AA | AAA | 18 | | ![#f78c6c](../../a11y_pygments/assets/f78c6c.png) | `#f78c6c` | 8.4 : 1 | AAA | AAA | 19 | | ![#9e8741](../../a11y_pygments/assets/9e8741.png) | `#9e8741` | 5.7 : 1 | AA | AAA | 20 | | ![#c5e478](../../a11y_pygments/assets/c5e478.png) | `#c5e478` | 13.9 : 1 | AAA | AAA | 21 | | ![#a2bffc](../../a11y_pygments/assets/a2bffc.png) | `#a2bffc` | 10.8 : 1 | AAA | AAA | 22 | | ![#5ca7e4](../../a11y_pygments/assets/5ca7e4.png) | `#5ca7e4` | 7.6 : 1 | AAA | AAA | 23 | | ![#9e86c8](../../a11y_pygments/assets/9e86c8.png) | `#9e86c8` | 6.3 : 1 | AA | AAA | 24 | -------------------------------------------------------------------------------- /a11y_pygments/greative/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/greative/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/greative/images/greative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/greative/images/greative.png -------------------------------------------------------------------------------- /a11y_pygments/greative/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#797979" 20 | orange = "#F78C6C" 21 | yellow = "#9e8741" 22 | green = "#c5e478" 23 | blue = "#a2bffc" 24 | cyan = "#5ca7e4" 25 | purple = "#9e86c8" 26 | black = "#a2bffc" 27 | 28 | 29 | class Theme(Style): 30 | """ 31 | This style mimics greative theme from vscode themes. 32 | """ 33 | 34 | default_style = "" 35 | 36 | background_color = "#010726" 37 | highlight_color = "#473d18" 38 | 39 | styles = { 40 | Text: Colors.black, # class: '' 41 | Error: Colors.blue, # class: 'err' 42 | Other: "", # class 'x' 43 | Comment: Colors.comment, # class: 'c' 44 | Keyword: Colors.purple, # class: 'k' 45 | Keyword.Constant: Colors.purple, # class: 'kc' 46 | # Keyword.Declaration: "", # class: 'kd' 47 | # Keyword.Namespace: "", # class: 'kn' 48 | # Keyword.Pseudo: "", # class: 'kp' 49 | # Keyword.Reserved: "", # class: 'kr' 50 | Keyword.Type: Colors.green, # class: 'kt' 51 | Operator: Colors.orange, # class: 'o' 52 | Operator.Word: Colors.purple, # class: 'ow' 53 | Punctuation: Colors.black, # class: 'p' 54 | Name: Colors.blue, # class: 'n' 55 | Name.Attribute: Colors.purple, # class: 'na' 56 | Name.Builtin: Colors.green, # class: 'nb' 57 | Name.Builtin.Pseudo: Colors.green, # class: 'bp' 58 | Name.Class: Colors.orange, # class: 'nc' 59 | Name.Constant: Colors.blue, # class: 'no' 60 | Name.Decorator: Colors.yellow, # class: 'nd' 61 | Name.Entity: Colors.yellow, # class: 'ni' 62 | Name.Exception: Colors.blue, # class: 'ne' 63 | Name.Function: Colors.purple, # class: 'nf' 64 | Name.Property: Colors.blue, # class: 'py' 65 | Name.Label: Colors.orange, # class: 'nl' 66 | Name.Namespace: Colors.green, # class: 'nn' 67 | # Name.Other: "", # class: 'nx' 68 | Name.Tag: Colors.cyan, # class: 'nt' 69 | Name.Variable: Colors.green, # class: 'nv' 70 | Name.Variable.Magic: Colors.orange, 71 | # Name.Variable.Class: "", # class: 'vc' 72 | # Name.Variable.Global: "", # class: 'vg' 73 | # Name.Variable.Instance: "", # class: 'vi' 74 | Number: Colors.purple, # class: 'm' 75 | # Number.Float: "", # class: 'mf' 76 | # Number.Hex: "", # class: 'mh' 77 | # Number.Integer: "", # class: 'mi' 78 | # Number.Integer.Long: "", # class: 'il' 79 | # Number.Oct: "", # class: 'mo' 80 | Literal: Colors.blue, # class: 'l' 81 | # Literal.Date: "", # class: 'ld' 82 | String: Colors.yellow, # class: 's' 83 | # String.Backtick: Colors.green, # class: 'sb' 84 | # String.Char: "", # class: 'sc' 85 | # String.Doc: "", # class: 'sd' 86 | # String.Double: "", # class: 's2' 87 | String.Escape: Colors.orange, # class: 'se' 88 | # String.Heredoc: "", # class: 'sh' 89 | # String.Interpol: "", # class: 'si' 90 | # String.Other: "", # class: 'sx' 91 | String.Regex: Colors.cyan, # class: 'sr' 92 | # String.Single: "", # class: 's1' 93 | String.Symbol: Colors.orange, # class: 'ss' 94 | # Generic: "", # class: 'g' 95 | Generic.Deleted: Colors.blue, # class: 'gd', 96 | Generic.Emph: "italic", # class: 'ge' 97 | # Generic.Error: "", # class: 'gr' 98 | Generic.Heading: Colors.blue, # class: 'gh' 99 | Generic.Subheading: Colors.blue, # class: 'gu' 100 | # Generic.Inserted: "", # class: 'gi' 101 | # Generic.Output: "", # class: 'go' 102 | # Generic.Prompt: "", # class: 'gp' 103 | Generic.Strong: "bold", # class: 'gs' 104 | # Generic.Traceback: "", # class: 'gt' 105 | } 106 | -------------------------------------------------------------------------------- /a11y_pygments/pitaya_smoothie/README.md: -------------------------------------------------------------------------------- 1 | # Pitaya Smoothie 2 | 3 | This style mimics the a11 light theme from eric bailey's accessible themes. 4 | 5 | ![Screenshot of the pitaya-smoothie theme in a bash script](./images/pitaya-smoothie.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#181036](https://via.placeholder.com/20/181036/181036.png) `#181036` 10 | 11 | Highlight color: ![#2A1968](https://via.placeholder.com/20/2A1968/2A1968.png) `#2A1968` 12 | 13 | **WCAG compliance** 14 | 15 | | Color | Hex | Ratio | Normal text | Large text | 16 | | ------------------------------------------------- | --------- | -------- | ----------- | ---------- | 17 | | ![#8786ac](../../a11y_pygments/assets/8786ac.png) | `#8786ac` | 5.2 : 1 | AA | AAA | 18 | | ![#f26196](../../a11y_pygments/assets/f26196.png) | `#f26196` | 5.9 : 1 | AA | AAA | 19 | | ![#f5a394](../../a11y_pygments/assets/f5a394.png) | `#f5a394` | 9.0 : 1 | AAA | AAA | 20 | | ![#fad000](../../a11y_pygments/assets/fad000.png) | `#fad000` | 12.1 : 1 | AAA | AAA | 21 | | ![#18c1c4](../../a11y_pygments/assets/18c1c4.png) | `#18c1c4` | 8.1 : 1 | AAA | AAA | 22 | | ![#66e9ec](../../a11y_pygments/assets/66e9ec.png) | `#66e9ec` | 12.4 : 1 | AAA | AAA | 23 | | ![#7998f2](../../a11y_pygments/assets/7998f2.png) | `#7998f2` | 6.5 : 1 | AA | AAA | 24 | | ![#c4a2f5](../../a11y_pygments/assets/c4a2f5.png) | `#c4a2f5` | 8.4 : 1 | AAA | AAA | 25 | | ![#fefeff](../../a11y_pygments/assets/fefeff.png) | `#fefeff` | 17.9 : 1 | AAA | AAA | 26 | -------------------------------------------------------------------------------- /a11y_pygments/pitaya_smoothie/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/pitaya_smoothie/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/pitaya_smoothie/images/pitaya-smoothie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/pitaya_smoothie/images/pitaya-smoothie.png -------------------------------------------------------------------------------- /a11y_pygments/pitaya_smoothie/style.py: -------------------------------------------------------------------------------- 1 | from pygments.style import Style 2 | from pygments.token import ( 3 | Comment, 4 | Error, 5 | Generic, 6 | Keyword, 7 | Literal, 8 | Name, 9 | Number, 10 | Operator, 11 | Other, 12 | Punctuation, 13 | String, 14 | Text, 15 | ) 16 | 17 | 18 | class Colors: 19 | comment = "#8786ac" 20 | red = "#F26196" 21 | orange = "#F5A394" 22 | yellow = "#FAD000" 23 | green = "#18C1C4" 24 | cyan = "#66E9EC" 25 | blue = "#7998F2" 26 | purple = "#C4A2F5" 27 | black = "#FEFEFF" 28 | 29 | 30 | class Theme(Style): 31 | """ 32 | This style mimics the a11 light theme from eric bailey's accessible themes. 33 | """ 34 | 35 | default_style = "" 36 | 37 | background_color = "#181036" 38 | highlight_color = "#2A1968" 39 | 40 | styles = { 41 | Text: Colors.black, # class: '' 42 | Error: Colors.red, # class: 'err' 43 | Other: "", # class 'x' 44 | Comment: Colors.comment, # class: 'c' 45 | Keyword: Colors.yellow, # class: 'k' 46 | Keyword.Constant: Colors.purple, # class: 'kc' 47 | # Keyword.Declaration: "", # class: 'kd' 48 | # Keyword.Namespace: "", # class: 'kn' 49 | # Keyword.Pseudo: "", # class: 'kp' 50 | # Keyword.Reserved: "", # class: 'kr' 51 | Keyword.Type: Colors.orange, # class: 'kt' 52 | Operator: Colors.green, # class: 'o' 53 | Operator.Word: Colors.purple, # class: 'ow' 54 | Punctuation: Colors.black, # class: 'p' 55 | Name: Colors.black, # class: 'n' 56 | Name.Attribute: Colors.yellow, # class: 'na' 57 | Name.Builtin: Colors.purple, # class: 'nb' 58 | Name.Builtin.Pseudo: Colors.orange, # class: 'bp' 59 | Name.Class: Colors.blue, # class: 'nc' 60 | Name.Constant: Colors.purple, # class: 'no' 61 | Name.Decorator: Colors.orange, # class: 'nd' 62 | Name.Entity: Colors.blue, # class: 'ni' 63 | Name.Exception: Colors.purple, # class: 'ne' 64 | Name.Function: Colors.blue, # class: 'nf' 65 | Name.Property: Colors.blue, # class: 'py' 66 | Name.Label: Colors.orange, # class: 'nl' 67 | Name.Namespace: Colors.black, # class: 'nn' 68 | # Name.Other: "", # class: 'nx' 69 | Name.Tag: Colors.blue, # class: 'nt' 70 | Name.Variable: Colors.orange, # class: 'nv' 71 | Name.Variable.Magic: Colors.orange, 72 | # Name.Variable.Class: "", # class: 'vc' 73 | # Name.Variable.Global: "", # class: 'vg' 74 | # Name.Variable.Instance: "", # class: 'vi' 75 | Number: Colors.orange, # class: 'm' 76 | # Number.Float: "", # class: 'mf' 77 | # Number.Hex: "", # class: 'mh' 78 | # Number.Integer: "", # class: 'mi' 79 | # Number.Integer.Long: "", # class: 'il' 80 | # Number.Oct: "", # class: 'mo' 81 | Literal: Colors.orange, # class: 'l' 82 | # Literal.Date: "", # class: 'ld' 83 | String: Colors.blue, # class: 's' 84 | String.Backtick: Colors.cyan, # class: 'sb' 85 | # String.Char: "", # class: 'sc' 86 | String.Doc: Colors.purple, # class: 'sd' 87 | # String.Double: "", # class: 's2' 88 | String.Escape: Colors.orange, # class: 'se' 89 | # String.Heredoc: "", # class: 'sh' 90 | # String.Interpol: "", # class: 'si' 91 | # String.Other: "", # class: 'sx' 92 | String.Regex: Colors.blue, # class: 'sr' 93 | # String.Single: "", # class: 's1' 94 | String.Symbol: Colors.blue, # class: 'ss' 95 | # Generic: "", # class: 'g' 96 | Generic.Deleted: Colors.blue, # class: 'gd', 97 | Generic.Emph: "italic", # class: 'ge' 98 | # Generic.Error: "", # class: 'gr' 99 | Generic.Heading: Colors.blue, # class: 'gh' 100 | Generic.Subheading: Colors.blue, # class: 'gu' 101 | # Generic.Inserted: "", # class: 'gi' 102 | # Generic.Output: "", # class: 'go' 103 | # Generic.Prompt: "", # class: 'gp' 104 | Generic.Strong: "bold", # class: 'gs' 105 | # Generic.Traceback: "", # class: 'gt' 106 | } 107 | -------------------------------------------------------------------------------- /a11y_pygments/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/a11y_pygments/utils/__init__.py -------------------------------------------------------------------------------- /a11y_pygments/utils/utils.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | 4 | from pathlib import Path 5 | from typing import Union 6 | 7 | from pygments.formatters import HtmlFormatter 8 | from pygments.styles import get_style_by_name 9 | from pygments.token import Text 10 | from setuptools import find_packages 11 | 12 | 13 | def find_all_themes_packages() -> list[str]: 14 | """Finds the currently supported themes in the a11y_pygments package. 15 | 16 | Returns: 17 | themes: list of themes under the a11y_pygments package 18 | """ 19 | exclude = {"test", "scripts", "a11y_pygments", "a11y_pygments.utils"} 20 | packages = set(find_packages()) 21 | themes = list(packages - exclude) 22 | # drop the a11y_pygments part of the pkg name 23 | themes = [x.split(".")[1] for x in themes] 24 | return themes 25 | 26 | 27 | def get_themes_names() -> list[str]: 28 | """Get themes names from the a11y_pygments package. 29 | 30 | Returns: 31 | themes: list of themes names 32 | """ 33 | themes = find_all_themes_packages() 34 | themes = [x.replace("_", "-") for x in themes] 35 | logging.info(f"Found pygment themes: {themes}") 36 | return themes 37 | 38 | 39 | def generate_css(themes: list[str], save_dir: Union[str, Path]): 40 | """Generate css for the available themes. 41 | Args: 42 | themes (list): list of themes names 43 | """ 44 | assert save_dir, "Must provide directory" 45 | 46 | for theme in themes: 47 | style = get_style_by_name(theme) 48 | formatter = HtmlFormatter(style=style, full=True, hl_lines=[2, 3, 4]) 49 | css = formatter.get_style_defs() 50 | color = style.style_for_token(Text)["color"] 51 | css += ( 52 | f"\n.highlight {{ background: {style.background_color}; color: #{color}; }}" 53 | ) 54 | package = theme.replace("-", "_") 55 | 56 | if not Path(save_dir).joinpath("css").exists(): 57 | os.mkdir(Path(save_dir).joinpath("css")) 58 | if "docs" in save_dir: 59 | out = Path(save_dir).joinpath("css", f"{package}-style.css") 60 | else: 61 | out = Path(save_dir) / package / "style.css" 62 | 63 | logging.info(f"Saving css to {out}") 64 | with open(out, "w") as f: 65 | f.write(css) 66 | -------------------------------------------------------------------------------- /a11y_pygments/utils/wcag_contrast.py: -------------------------------------------------------------------------------- 1 | # Methods to calculate WCAG contrast ratio and check if it passes AA or AAA 2 | # https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html 3 | 4 | import re 5 | 6 | from typing import NewType, Tuple, TypeAlias, Union 7 | 8 | 9 | # float01 is a float greater than or equal to 0 and less than or equal to 1 10 | float01 = NewType("float01", float) 11 | RGBColor: TypeAlias = Tuple[float01, float01, float01] 12 | 13 | 14 | def hexdd_to_float01(xx: str) -> float01: 15 | """Convert a two-digit, 8-bit hex value to a float between 0 and 1. 16 | 17 | >>> hexdd_to_float01("00") 18 | 0.0 19 | >>> hexdd_to_float01("33") 20 | 0.2 21 | >>> hexdd_to_float01("55") 22 | 0.3333333333333333 23 | >>> hexdd_to_float01("cc") 24 | 0.8 25 | >>> hexdd_to_float01("ff") 26 | 1.0 27 | """ 28 | return float01(int(xx, 16) / 255) 29 | 30 | 31 | def hex_to_rgb01(hex: str) -> RGBColor: 32 | """Convert a hex defined colour to RGB. 33 | 34 | Args: 35 | hex (string): color in hex format (#rrggbb/#rgb) 36 | 37 | Returns: 38 | rgb: tuple of rgb values ``(r, g, b)``, where each channel (red, green, 39 | blue) can assume values between 0 and 1 (inclusive). 40 | """ 41 | 42 | if re.match(r"\A#[a-fA-F0-9]{6}\Z", hex): 43 | # Full hex color (#rrggbb) format 44 | return ( 45 | hexdd_to_float01(hex[1:3]), 46 | hexdd_to_float01(hex[3:5]), 47 | hexdd_to_float01(hex[5:7]), 48 | ) 49 | 50 | if re.match(r"\A#[a-fA-F0-9]{3}\Z", hex): 51 | # Short hex color (#rgb) format, shorthand for #rrggbb 52 | return ( 53 | hexdd_to_float01(hex[1] * 2), 54 | hexdd_to_float01(hex[2] * 2), 55 | hexdd_to_float01(hex[3] * 2), 56 | ) 57 | 58 | raise ValueError("Invalid hex color format") 59 | 60 | 61 | def sRGB_channel(v: float01) -> float: 62 | """Colors need to be normalised (from a sRGB space) before computing the relative 63 | luminance. 64 | 65 | Args: 66 | v (float): r,g,b channels values between 0 and 1 67 | 68 | Returns: 69 | float: sRGB channel value for a given rgb color channel 70 | """ 71 | if v <= 0.04045: 72 | return v / 12.92 73 | else: 74 | return ((v + 0.055) / 1.055) ** 2.4 75 | 76 | 77 | def relative_luminance(color: RGBColor) -> float: 78 | """Compute the relative luminance of a color. 79 | 80 | Args: 81 | color (tuple): rgb color tuple ``(r, g, b)`` 82 | 83 | Returns: 84 | float: relative luminance of a color 85 | """ 86 | r, g, b = color 87 | r_ = sRGB_channel(r) 88 | g_ = sRGB_channel(g) 89 | b_ = sRGB_channel(b) 90 | 91 | return 0.2126 * r_ + 0.7152 * g_ + 0.0722 * b_ 92 | 93 | 94 | def contrast_ratio(color1: RGBColor, color2: RGBColor) -> float: 95 | """Compute the contrast ratio between two colors. 96 | 97 | Args: 98 | color1 (tuple): rgb color tuple ``(r, g, b)`` 99 | color2 (tuple): rgb color tuple ``(r, g, b)`` 100 | 101 | Returns: 102 | float: contrast ratio between two colors 103 | """ 104 | 105 | l1 = relative_luminance(color1) 106 | l2 = relative_luminance(color2) 107 | 108 | if l1 > l2: 109 | return (l1 + 0.05) / (l2 + 0.05) 110 | else: 111 | return (l2 + 0.05) / (l1 + 0.05) 112 | 113 | 114 | def passes_contrast( 115 | color1: RGBColor, color2: RGBColor, level="AA" 116 | ) -> Union[bool, float]: 117 | """Method to verify the contrast ratio between two colours. 118 | 119 | Args: 120 | color1 (tuple): rgb color tuple ``(r, g, b)`` 121 | color2 (tuple): rgb color tuple ``(r, g, b)`` 122 | level (str, optional): WCAG contrast level. Defaults to "AA". 123 | """ 124 | 125 | ratio = contrast_ratio(color1, color2) 126 | 127 | if level == "AA": 128 | if ratio >= 4.5: 129 | return round(ratio, 2) 130 | else: 131 | return False 132 | elif level == "AAA": 133 | if ratio >= 7.0: 134 | return round(ratio, 2) 135 | else: 136 | return False 137 | 138 | raise ValueError("level must be either 'AA' or 'AAA'") 139 | 140 | 141 | def get_wcag_level_normal_text(contrast: float) -> str: 142 | """Does the given contrast meet level AA or level AAA for normal size text""" 143 | if contrast >= 7: 144 | return "AAA" 145 | elif contrast >= 4.5: 146 | return "AA" 147 | else: 148 | return "" 149 | 150 | 151 | def get_wcag_level_large_text(contrast: float) -> str: 152 | """Does the given contrast meet level AA or level AAA for large text""" 153 | if contrast >= 4.5: 154 | return "AAA" 155 | elif contrast >= 3: 156 | return "AA" 157 | else: 158 | return "" 159 | 160 | 161 | def hexstr_without_hash(hex_color: str) -> str: 162 | """Remove '#' from hex color strings. 163 | 164 | Usage example: 165 | 166 | >>> hexstr_without_hash("#fff") 167 | 'fff' 168 | """ 169 | return hex_color.replace("#", "") 170 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/docs/.nojekyll -------------------------------------------------------------------------------- /docs/dark_themes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/docs/dark_themes.png -------------------------------------------------------------------------------- /docs/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif; 3 | } 4 | 5 | .title { 6 | display: flex; 7 | justify-content: center; 8 | } 9 | 10 | .selection { 11 | display: flex; 12 | justify-content: center; 13 | } 14 | 15 | .cards { 16 | display: flex; 17 | flex-wrap: wrap; 18 | justify-content: space-evenly; 19 | } 20 | 21 | .card { 22 | margin: 10px; 23 | display: flex; 24 | justify-content: center; 25 | flex-direction: column; 26 | } 27 | 28 | .card-title { 29 | align-self: center; 30 | } 31 | 32 | .card-body { 33 | width: 400px; 34 | height: 400px; 35 | padding: 0 0 20px 20px; 36 | vertical-align: top; 37 | } 38 | 39 | iframe { 40 | width: 100%; 41 | height: 100%; 42 | } 43 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Accessible Pygments Themes 6 | 7 | 13 | 14 | 15 |
16 |

Accessible Pygments Themes Demo 🎨

17 |
18 |
19 | 20 | 21 | 39 |
40 | 41 |
42 | 43 | 44 |
45 |
46 |

Bash

47 |
48 |
49 | 53 |
54 |
55 | 56 | 57 | 58 |
59 |
60 |

Javascript

61 |
62 |
63 | 67 |
68 |
69 | 70 | 71 | 72 |
73 |
74 |

CSS

75 |
76 |
77 | 81 |
82 |
83 | 84 | 85 | 86 |
87 |
88 |

HTML

89 |
90 |
91 | 95 |
96 |
97 | 98 | 99 | 100 |
101 |
102 |

Markdown

103 |
104 |
105 | 109 |
110 |
111 | 112 | 113 | 114 |
115 |
116 |

Python

117 |
118 |
119 | 123 |
124 |
125 |
126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /docs/index.js: -------------------------------------------------------------------------------- 1 | // Get the dropdown, reload all the 8 | // iframes on the page with examples from the new chosen theme 9 | select.addEventListener("change", (event) => { 10 | const nextTheme = event.currentTarget.value; 11 | document.querySelectorAll("iframe").forEach((element) => { 12 | // Replace theme name in URL to load example from new theme 13 | element.src = element.src.replace(currentTheme, nextTheme); 14 | }); 15 | currentTheme = nextTheme; 16 | }); 17 | -------------------------------------------------------------------------------- /docs/light_themes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/docs/light_themes.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling", "hatch-fancy-pypi-readme", "hatch-vcs"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "accessible-pygments" 7 | description = "A collection of accessible pygments styles" 8 | license = { text = "BSD-3-Clause" } 9 | requires-python = ">=3.9" 10 | authors = [ 11 | { name = "Stephannie Jimenez Gacha", email = "steff456@hotmail.com" }, 12 | { name = "Tania Allard", email = "trallard@bitsandchips.me" }, 13 | ] 14 | maintainers = [ 15 | { name = "Gabriel Fouasnon", email = "gabriel@fouasnon.com" }, 16 | ] 17 | keywords = ["a11y", "accessibility", "pygments", "WCAG", "Sphinx"] 18 | classifiers = [ 19 | "Intended Audience :: Developers", 20 | "Intended Audience :: Education", 21 | "Intended Audience :: Information Technology", 22 | "Intended Audience :: Science/Research", 23 | "License :: OSI Approved :: BSD License", 24 | "Operating System :: OS Independent", 25 | "Programming Language :: Python", 26 | "Programming Language :: Python :: 3", 27 | "Programming Language :: Python :: 3.9", 28 | "Programming Language :: Python :: 3.10", 29 | "Programming Language :: Python :: 3.11", 30 | "Programming Language :: Python :: 3.12", 31 | "Development Status :: 3 - Alpha", 32 | "Topic :: Software Development :: Libraries :: Python Modules", 33 | ] 34 | dependencies = ["pygments >= 1.5"] 35 | dynamic = ["version", "readme"] 36 | 37 | [project.entry-points."pygments.styles"] 38 | a11y-dark = "a11y_pygments.a11y_dark.style:Theme" 39 | a11y-high-contrast-dark = "a11y_pygments.a11y_high_contrast_dark.style:Theme" 40 | a11y-high-contrast-light = "a11y_pygments.a11y_high_contrast_light.style:Theme" 41 | a11y-light = "a11y_pygments.a11y_light.style:Theme" 42 | blinds-dark = "a11y_pygments.blinds_dark.style:Theme" 43 | blinds-light = "a11y_pygments.blinds_light.style:Theme" 44 | github-dark = "a11y_pygments.github_dark.style:Theme" 45 | github-dark-colorblind = "a11y_pygments.github_dark_colorblind.style:Theme" 46 | github-dark-high-contrast = "a11y_pygments.github_dark_high_contrast.style:Theme" 47 | github-light = "a11y_pygments.github_light.style:Theme" 48 | github-light-colorblind = "a11y_pygments.github_light_colorblind.style:Theme" 49 | github-light-high-contrast = "a11y_pygments.github_light_high_contrast.style:Theme" 50 | gotthard-dark = "a11y_pygments.gotthard_dark.style:Theme" 51 | gotthard-light = "a11y_pygments.gotthard_light.style:Theme" 52 | greative = "a11y_pygments.greative.style:Theme" 53 | pitaya-smoothie = "a11y_pygments.pitaya_smoothie.style:Theme" 54 | 55 | [project.urls] 56 | Homepage = "https://github.com/Quansight-Labs/accessible-pygments" 57 | "Bug Reports" = "https://github.com/Quansight-Labs/accessible-pygments/issues" 58 | 59 | [tool.hatch.metadata.hooks.fancy-pypi-readme] 60 | content-type = "text/markdown" 61 | 62 | [[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] 63 | path = "README.md" 64 | 65 | [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] 66 | # Literal TOML strings (single quotes) need no escaping of backslashes. 67 | pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' 68 | replacement = '[\1](https://github.com/Quansight-Labs/accessible-pygments/tree/main/\g<2>)' 69 | 70 | [tool.hatch.version] 71 | source = "vcs" 72 | raw-options = { local_scheme = "no-local-version" } 73 | 74 | [project.optional-dependencies] 75 | tests = ["hypothesis", "pytest"] 76 | dev = [ 77 | "pre-commit", 78 | "setuptools", 79 | "playwright", 80 | "pillow", 81 | "twine>=5.0", 82 | "pkginfo>=1.10", # needed to support metadata 2.3 83 | ] 84 | 85 | [tool.hatch.build.targets] 86 | sdist = { exclude = ["/.github", "/docs", "/test", "/scripts"] } 87 | wheel = { packages = ["a11y_pygments"] } 88 | 89 | [tool.hatch.envs.dev] 90 | features = ["dev"] 91 | post-install-commands = ["playwright install"] 92 | 93 | [tool.hatch.envs.test] 94 | features = ["tests"] 95 | 96 | [tool.hatch.envs.dev.scripts] 97 | lint = "pre-commit run --all-files" 98 | render_html = "python test/render_html.py" 99 | create_css = "python test/run_css.py --save-dir docs/_build" 100 | update_theme_docs = "python scripts/update_theme_docs.py" 101 | 102 | [tool.hatch.envs.test.scripts] 103 | tests = "python -m pytest test/test_*.py" 104 | 105 | [tool.isort] 106 | profile = "black" 107 | skip_gitignore = true 108 | lines_between_types = 1 109 | lines_after_imports = 2 110 | 111 | [tool.ruff] 112 | fix = true 113 | exclude = ["test/scripts/*.py"] 114 | ignore = [ 115 | "E501", 116 | # line too long | Black takes care of this 117 | ] 118 | -------------------------------------------------------------------------------- /scripts/templates/theme_readme.md: -------------------------------------------------------------------------------- 1 | # $theme_title 2 | 3 | $theme_docstring 4 | 5 | ![Screenshot of the $theme theme in a bash script](./images/$theme.png) 6 | 7 | ## Colors 8 | 9 | Background color: ![#$background_hex](https://via.placeholder.com/20/$background_hex/$background_hex.png) `#$background_hex` 10 | 11 | Highlight color: ![#$highlight_hex](https://via.placeholder.com/20/$highlight_hex/$highlight_hex.png) `#$highlight_hex` 12 | 13 | **WCAG compliance** 14 | 15 | $contrast_table 16 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quansight-Labs/accessible-pygments/a5f7fb9b2be360cff9622d9d6c22a3bae62435e3/test/__init__.py -------------------------------------------------------------------------------- /test/render_html.py: -------------------------------------------------------------------------------- 1 | """ 2 | Script to create individual HTML samples for each of the themes in accessible-pygments. 3 | 4 | Usage:: 5 | 6 | python test/render_html.py 7 | """ 8 | 9 | import os 10 | 11 | from pathlib import Path 12 | 13 | from pygments import highlight as pygments_highlight 14 | from pygments.formatters import HtmlFormatter 15 | from pygments.lexers import get_lexer_by_name 16 | from pygments.styles import get_style_by_name 17 | 18 | from a11y_pygments.utils.utils import get_themes_names 19 | 20 | 21 | # List of available language examples 22 | languages = { 23 | "python": "py", 24 | "javascript": "js", 25 | "bash": "bash", 26 | "html": "html", 27 | "css": "css", 28 | "markdown": "md", 29 | } 30 | 31 | # Setting directories 32 | HERE = Path(__file__).parent 33 | outdir = HERE.parent / "docs" / "_build" 34 | 35 | 36 | def render_html(themes: list, languages=languages, outdir=outdir): 37 | """Generate rendered HTML sample of the themes for the specified languages. 38 | 39 | Args: 40 | themes (list): list of registred themes. 41 | languages (dict, optional): Dict containing the languages samples to render. 42 | Defaults to languages. 43 | outdir (pathlib.Path, optional): Directory to save the rendered HTML files to. 44 | Defaults to outdir. 45 | """ 46 | 47 | if not outdir.exists(): 48 | os.mkdir(outdir) 49 | 50 | for theme in themes: 51 | 52 | theme_outdir = outdir / theme 53 | if not theme_outdir.exists(): 54 | os.mkdir(theme_outdir) 55 | 56 | style = get_style_by_name(theme) 57 | # ref: https://pygments.org/docs/formatters/#HtmlFormatter 58 | formatter = HtmlFormatter(style=style, full=True, hl_lines=[2, 3, 4]) 59 | 60 | for language in languages: 61 | ext = languages[language] 62 | name = HERE / "scripts" / f"test.{ext}" 63 | 64 | with open(name, "r") as f: 65 | lines = f.read() 66 | 67 | lexer = get_lexer_by_name(language, stripall=True) 68 | result = pygments_highlight(lines, lexer, formatter) 69 | 70 | out = theme_outdir / f"{ext}.html" 71 | with open(out, "w") as f: 72 | f.write(result) 73 | 74 | 75 | if __name__ == "__main__": 76 | # get names of all themes 77 | themes = get_themes_names() 78 | render_html(themes) 79 | -------------------------------------------------------------------------------- /test/run_css.py: -------------------------------------------------------------------------------- 1 | """ 2 | Script to generate the css files for the themes in accessible-pygments. 3 | 4 | Usage:: 5 | 6 | python test/run_css.py 7 | """ 8 | 9 | import argparse 10 | import logging 11 | 12 | from pathlib import Path 13 | 14 | from a11y_pygments.utils.utils import generate_css, get_themes_names 15 | 16 | 17 | if __name__ == "__main__": 18 | parser = argparse.ArgumentParser() 19 | parser.add_argument( 20 | "--save-dir", 21 | type=str, 22 | default="", 23 | help="Directory to save the css files", 24 | required=True, 25 | ) 26 | args = parser.parse_args() 27 | 28 | save_dir = Path(args.save_dir).resolve() 29 | logging.info(f"Saving css files to {save_dir}") 30 | 31 | themes = get_themes_names() 32 | generate_css(themes, args.save_dir) 33 | -------------------------------------------------------------------------------- /test/scripts/test.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Counting the number of lines in a list of files 3 | # function version 4 | 5 | # function storing list of all files in variable files 6 | get_files () { 7 | files="`ls *.[ch]`" 8 | } 9 | 10 | # function counting the number of lines in a file 11 | count_lines () { 12 | f=$1 # 1st argument is filename 13 | l=`wc -l $f | sed 's/^\([0-9]*\).*$/\1/'` # number of lines 14 | } 15 | 16 | # the script should be called without arguments 17 | if [ $# -ge 1 ] 18 | then 19 | echo "Usage: $0 " 20 | exit 1 21 | fi 22 | 23 | # split by newline 24 | IFS=$'\012' 25 | 26 | echo "$0 counts the lines of code" 27 | # don't forget to initialise! 28 | l=0 29 | n=0 30 | s=0 31 | # call a function to get a list of files 32 | get_files 33 | # iterate over this list 34 | for f in $files 35 | do 36 | # call a function to count the lines 37 | count_lines $f 38 | echo "$f: $l"loc 39 | # store filename in an array 40 | file[$n]=$f 41 | # store number of lines in an array 42 | lines[$n]=$l 43 | # increase counter 44 | n=$[ $n + 1 ] 45 | # increase sum of all lines 46 | s=$[ $s + $l ] 47 | done 48 | 49 | echo "$n files in total, with $s lines in total" 50 | i=5 51 | echo "The $i-th file was ${file[$i]} with ${lines[$i]} lines" 52 | 53 | ###### CONFIG 54 | ACCEPTED_HOSTS="/root/.hag_accepted.conf" 55 | BE_VERBOSE=false 56 | 57 | if [ "$UID" -ne 0 ] 58 | then 59 | echo "Superuser rights required" 60 | exit 2 61 | fi 62 | 63 | genApacheConf(){ 64 | echo -e "# Host ${HOME_DIR}$1/$2 :" 65 | } 66 | -------------------------------------------------------------------------------- /test/scripts/test.css: -------------------------------------------------------------------------------- 1 | .top-title { 2 | font-size: 1.5rem; 3 | font-family: "Leckerli One", cursive; 4 | } 5 | 6 | header { 7 | position: relative; 8 | z-index: 999; 9 | } 10 | 11 | .bg-blue { 12 | background-color: rgba(135, 212, 230, 0.7); 13 | border-color: #87d4e6; 14 | padding: 0; 15 | } 16 | 17 | .bg-bottom-dark { 18 | background-color: #454545; 19 | border-color: #454545; 20 | } 21 | 22 | .bottom-firm { 23 | font-size: 3rem; 24 | color: #e2eb98; 25 | font-family: "Leckerli One", cursive; 26 | } 27 | 28 | .sky-blue-header { 29 | background-color: #87d4e6; 30 | height: 70px; 31 | min-width: 100%; 32 | clear: both; 33 | margin: 0; 34 | padding: 0; 35 | } 36 | 37 | .balloons-main { 38 | min-width: 100%; 39 | width: 100%; 40 | clear: both; 41 | margin: 0; 42 | padding: 0; 43 | position: relative; 44 | } 45 | 46 | .center-text { 47 | position: absolute; 48 | top: 20%; 49 | left: 40%; 50 | transform: translate(-50%, -50%); 51 | color: #f1faee; 52 | font-family: "Delius Swash Caps", cursive; 53 | } 54 | 55 | .h1 #welcome-text { 56 | font-size: 5em; 57 | } 58 | 59 | .center-bottom-medium { 60 | position: absolute; 61 | top: 40%; 62 | left: 70%; 63 | transform: translate(-50%, -50%); 64 | color: #f1faee; 65 | font-family: "Delius Swash Caps", cursive; 66 | } 67 | 68 | .center-bottom { 69 | position: absolute; 70 | top: 58%; 71 | left: 70%; 72 | transform: translate(-50%, -50%); 73 | color: #f1faee; 74 | font-family: "Delius Swash Caps", cursive; 75 | } 76 | 77 | .about-me { 78 | position: relative; 79 | margin-top: 5%; 80 | } 81 | 82 | .available { 83 | position: relative; 84 | } 85 | 86 | .hire-me { 87 | position: relative; 88 | margin-top: 3%; 89 | margin-bottom: 3%; 90 | } 91 | 92 | .paragraph-block { 93 | margin-top: 3%; 94 | font-family: "Montserrat", sans-serif; 95 | font-size: 1.6rem; 96 | } 97 | 98 | .paragraph-block-text { 99 | margin-top: 3%; 100 | font-family: "Montserrat", sans-serif; 101 | font-size: 1.2rem; 102 | color: #818181; 103 | } 104 | 105 | .title-block { 106 | margin-top: 3%; 107 | margin-bottom: 3%; 108 | font-family: "Montserrat", cursive; 109 | font-size: 2rem; 110 | color: #0fa3b1; 111 | } 112 | 113 | .sep { 114 | margin-top: 3%; 115 | margin-bottom: 3%; 116 | } 117 | 118 | .my-button { 119 | color: #ffffff; 120 | background-color: #a385bd; 121 | border-color: #a385bd; 122 | font-family: "Montserrat", sans-serif; 123 | font-size: 2rem; 124 | } 125 | 126 | .highlight { 127 | color: #0fa3b1; 128 | font-size: 1.5rem; 129 | } 130 | 131 | .highlight-link { 132 | color: #0fa3b1; 133 | font-size: 1.2rem; 134 | } 135 | 136 | .caption-text-skills { 137 | font-size: 1.3rem; 138 | } 139 | 140 | .even { 141 | flex-wrap: wrap; 142 | } 143 | 144 | .machinel-block { 145 | background-color: #7a306c; 146 | color: white; 147 | padding: 4em 0; 148 | } 149 | 150 | .machinel-block p { 151 | letter-spacing: 1px; 152 | } 153 | 154 | .machinel-block .p-2 { 155 | margin: 0.7em 0; 156 | } 157 | 158 | .titleML { 159 | font-size: 1.6rem; 160 | font-family: "Delius Swash Caps", cursive; 161 | } 162 | 163 | .mandible-block { 164 | background-color: #7fc6a4; 165 | color: white; 166 | padding: 4em 0; 167 | } 168 | 169 | .mandible-block p { 170 | letter-spacing: 1px; 171 | } 172 | 173 | .mandible-block .p-2 { 174 | margin: 0.7em 0; 175 | } 176 | 177 | .math-exp-block { 178 | background-color: #f25f5c; 179 | color: white; 180 | padding: 4em 0; 181 | } 182 | 183 | .math-exp-block p { 184 | letter-spacing: 1px; 185 | } 186 | 187 | .math-exp-block .p-2 { 188 | margin: 0.7em 0; 189 | } 190 | 191 | video { 192 | width: 100%; 193 | } 194 | -------------------------------------------------------------------------------- /test/scripts/test.js: -------------------------------------------------------------------------------- 1 | function main(){ 2 | var lastScrollTop = 0; 3 | var animationEnd = 'animationend oAnimationEnd mozAnimationEnd webkitAnimationEnd'; 4 | $(document).scroll( _.throttle(function() { 5 | var st = $(this).scrollTop(); 6 | if ( st > lastScrollTop ) 7 | { 8 | runAnimation("#home-header", "slideOutUp faster"); 9 | } 10 | else 11 | { 12 | runAnimation("#home-header", "slideInDown faster"); 13 | } 14 | lastScrollTop = st; 15 | }, 500 16 | )); 17 | 18 | function runAnimation(element, animationName) { 19 | $(element).removeClass("animated slideInDown slideOutUp"); 20 | $(element).addClass("animated " +animationName).one(animationEnd, function() { 21 | animationRunning = false; 22 | }); 23 | } 24 | 25 | } 26 | 27 | $(document).ready(main); 28 | -------------------------------------------------------------------------------- /test/scripts/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | __Advertisement :)__ 3 | 4 | - __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image 5 | resize in browser. 6 | - __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly 7 | i18n with plurals support and easy syntax. 8 | 9 | You will like those projects! 10 | --- 11 | 12 | # h1 Heading 8-) 13 | 14 | ## h2 Heading 15 | 16 | ### h3 Heading 17 | 18 | #### h4 Heading 19 | 20 | ##### h5 Heading 21 | 22 | ###### h6 Heading 23 | 24 | ## Horizontal Rules 25 | 26 | --- 27 | 28 | --- 29 | 30 | --- 31 | 32 | ## Typographic replacements 33 | 34 | Enable typographer option to see result. 35 | 36 | (c) (C) (r) (R) (tm) (TM) (p) (P) +- 37 | 38 | test.. test... test..... test?..... test!.... 39 | 40 | !!!!!! ???? ,, -- --- 41 | 42 | "Smartypants, double quotes" and 'single quotes' 43 | 44 | ## Emphasis 45 | 46 | **This is bold text** 47 | 48 | **This is bold text** 49 | 50 | _This is italic text_ 51 | 52 | _This is italic text_ 53 | 54 | ~~Strikethrough~~ 55 | 56 | ## Blockquotes 57 | 58 | > Blockquotes can also be nested... 59 | > 60 | > > ...by using additional greater-than signs right next to each other... 61 | > > 62 | > > > ...or with spaces between arrows. 63 | 64 | ## Lists 65 | 66 | Unordered 67 | 68 | - Create a list by starting a line with `+`, `-`, or `*` 69 | - Sub-lists are made by indenting 2 spaces: 70 | - Marker character change forces new list start: 71 | - Ac tristique libero volutpat at 72 | * Facilisis in pretium nisl aliquet 73 | - Nulla volutpat aliquam velit 74 | - Very easy! 75 | 76 | Ordered 77 | 78 | 1. Lorem ipsum dolor sit amet 79 | 2. Consectetur adipiscing elit 80 | 3. Integer molestie lorem at massa 81 | 82 | 4. You can use sequential numbers... 83 | 5. ...or keep all the numbers as `1.` 84 | 85 | Start numbering with offset: 86 | 87 | 57. foo 88 | 1. bar 89 | 90 | ## Code 91 | 92 | Inline `code` 93 | 94 | Indented code 95 | 96 | // Some comments 97 | line 1 of code 98 | line 2 of code 99 | line 3 of code 100 | 101 | Block code "fences" 102 | 103 | ``` 104 | Sample text here... 105 | ``` 106 | 107 | Syntax highlighting 108 | 109 | ```js 110 | var foo = function (bar) { 111 | return bar++; 112 | }; 113 | 114 | console.log(foo(5)); 115 | ``` 116 | 117 | ## Tables 118 | 119 | | Option | Description | 120 | | ------ | ------------------------------------------------------------------------- | 121 | | data | path to data files to supply the data that will be passed into templates. | 122 | | engine | engine to be used for processing templates. Handlebars is the default. | 123 | | ext | extension to be used for dest files. | 124 | 125 | Right aligned columns 126 | 127 | | Option | Description | 128 | | -----: | ------------------------------------------------------------------------: | 129 | | data | path to data files to supply the data that will be passed into templates. | 130 | | engine | engine to be used for processing templates. Handlebars is the default. | 131 | | ext | extension to be used for dest files. | 132 | 133 | ## Links 134 | 135 | [link text](http://dev.nodeca.com) 136 | 137 | [link with title](http://nodeca.github.io/pica/demo/ "title text!") 138 | 139 | Autoconverted link https://github.com/nodeca/pica (enable linkify to see) 140 | 141 | ## Images 142 | 143 | ![Minion](https://octodex.github.com/images/minion.png) 144 | ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") 145 | 146 | Like links, Images also have a footnote style syntax 147 | 148 | ![Alt text][id] 149 | 150 | With a reference later in the document defining the URL location: 151 | 152 | [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" 153 | 154 | ## Plugins 155 | 156 | The killer feature of `markdown-it` is very effective support of 157 | [syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin). 158 | 159 | ### [Emojies](https://github.com/markdown-it/markdown-it-emoji) 160 | 161 | > Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum: 162 | > 163 | > Shortcuts (emoticons): :-) :-( 8-) ;) 164 | 165 | see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji. 166 | 167 | ### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup) 168 | 169 | - 19^th^ 170 | - H~2~O 171 | 172 | ### [\](https://github.com/markdown-it/markdown-it-ins) 173 | 174 | ++Inserted text++ 175 | 176 | ### [\](https://github.com/markdown-it/markdown-it-mark) 177 | 178 | ==Marked text== 179 | 180 | ### [Footnotes](https://github.com/markdown-it/markdown-it-footnote) 181 | 182 | Footnote 1 link[^first]. 183 | 184 | Footnote 2 link[^second]. 185 | 186 | Inline footnote^[Text of inline footnote] definition. 187 | 188 | Duplicated footnote reference[^second]. 189 | 190 | [^first]: Footnote **can have markup** 191 | 192 | and multiple paragraphs. 193 | 194 | [^second]: Footnote text. 195 | 196 | ### [Definition lists](https://github.com/markdown-it/markdown-it-deflist) 197 | 198 | Term 1 199 | 200 | : Definition 1 201 | with lazy continuation. 202 | 203 | Term 2 with _inline markup_ 204 | 205 | : Definition 2 206 | 207 | { some code, part of Definition 2 } 208 | 209 | Third paragraph of definition 2. 210 | 211 | _Compact style:_ 212 | 213 | Term 1 214 | ~ Definition 1 215 | 216 | Term 2 217 | ~ Definition 2a 218 | ~ Definition 2b 219 | 220 | ### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr) 221 | 222 | This is HTML abbreviation example. 223 | 224 | It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. 225 | 226 | \*[HTML]: Hyper Text Markup Language 227 | 228 | ### [Custom containers](https://github.com/markdown-it/markdown-it-container) 229 | 230 | ::: warning 231 | _here be dragons_ 232 | ::: 233 | -------------------------------------------------------------------------------- /test/scripts/test.py: -------------------------------------------------------------------------------- 1 | """ 2 | isort:skip_file 3 | """ 4 | 5 | import package 6 | from package import Class1, Class2, func_1, func_2 7 | from package3 import * 8 | 9 | 10 | class TestClass(BaseClass1, BaseClass2): 11 | """ Hola! """ 12 | def __init__(self, x: int, y: List[Union[None, str]], z='default', 13 | *args, **kwargs): 14 | super().__init__() 15 | self.x = x # type: int 16 | 17 | def method1(self): 18 | pass 19 | 20 | 21 | @decorator 22 | async def test2(x, y, z): 23 | async for i in x: 24 | yield y 25 | with open('text', 'r', encoding='utf-8') as f: 26 | while True: 27 | x += 1 28 | 29 | @requires_authorization 30 | def somefunc(param1='', param2=0): 31 | r'''A docstring''' 32 | if param1 > param2: # interesting 33 | print('Gre\'ater') 34 | return (param2 - param1 + 1 + 0b10l) or None 35 | 36 | class SomeClass: 37 | pass 38 | 39 | >>> message = '''interpreter 40 | ... prompt''' 41 | -------------------------------------------------------------------------------- /test/test_contrast.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from hypothesis import given 4 | from hypothesis.strategies import floats, tuples 5 | 6 | from a11y_pygments.utils import wcag_contrast as wcag 7 | 8 | 9 | color_channel = floats(0.0, 1.0) 10 | color = tuples(color_channel, color_channel, color_channel) 11 | 12 | 13 | @pytest.mark.parametrize( 14 | "rgb1,rgb2,expected", 15 | [ 16 | [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0), 21.0], 17 | [(0.0, 0.0, 0.0), (0.0, 0.0, 0.0), 1.0], 18 | [(0.0, 198 / 255.0, 0.0), (0.0, 0.0, 198 / 255.0), 5.000229313902297], 19 | ], 20 | ) 21 | def test_luminance(rgb1, rgb2, expected): 22 | c1 = wcag.contrast_ratio(rgb1, rgb2) 23 | c2 = wcag.contrast_ratio(rgb2, rgb1) 24 | assert c1 == expected 25 | assert c2 == expected 26 | 27 | 28 | @pytest.mark.parametrize( 29 | "c1,c2, expected", 30 | [ 31 | ("#0a1103", "#0a1103", False), 32 | ("#F1AAC4", "#FEF8FA", False), 33 | ("#610C2B", "#FEF8FA", 12.55), 34 | ("#1B78CA", "#FEF8FA", False), 35 | ("#1B78CA", "#FEF8FA", False), 36 | ("#2E3A89", "#FEF8FA", 9.61), 37 | ("#0B3254", "#0B3254", False), 38 | ("#FBE9F0", "#0B3254", 11.27), 39 | ], 40 | ) 41 | def test_passes_contrast(c1, c2, expected): 42 | got = wcag.passes_contrast(wcag.hex_to_rgb01(c1), wcag.hex_to_rgb01(c2), "AA") 43 | assert got == expected 44 | 45 | 46 | @given(color, color) 47 | def test_contrast(rgb1, rgb2): 48 | c1 = wcag.contrast_ratio(rgb1, rgb2) 49 | c2 = wcag.contrast_ratio(rgb2, rgb1) 50 | assert 1.0 <= c1 <= 21.0 51 | assert c1 == c2 52 | --------------------------------------------------------------------------------