{"id":24334,"library":"pygments-styles","title":"pygments-styles","description":"A curated collection of Pygments styles based on VS Code themes. Current version 0.3.0, released on an as-needed basis (latest update: 2026-04-02). Requires Python >=3.9.","status":"active","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/lepture/pygments-styles","tags":["pygments","syntax-highlighting","vscode-themes"],"install":[{"cmd":"pip install pygments-styles","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"PygmentsStylesRegistry is exposed at package root since v0.1.0; submodule import may fail.","wrong":"from pygments_styles.registry import PygmentsStylesRegistry","symbol":"PygmentsStylesRegistry","correct":"from pygments_styles import PygmentsStylesRegistry"},{"note":"list_styles is a top-level function, not in a submodule.","wrong":"from pygments_styles.styles import list_styles","symbol":"list_styles","correct":"from pygments_styles import list_styles"},{"note":"get_style_by_name is at package root since v0.1.0.","wrong":"from pygments_styles.utils import get_style_by_name","symbol":"get_style_by_name","correct":"from pygments_styles import get_style_by_name"}],"quickstart":{"code":"from pygments import highlight\nfrom pygments.lexers import PythonLexer\nfrom pygments.formatters import HtmlFormatter\nfrom pygments_styles import get_style_by_name\n\ncode = 'print(\"Hello, World!\")'\nstyle = get_style_by_name('github-dark')\nformatter = HtmlFormatter(style=style)\nresult = highlight(code, PythonLexer(), formatter)\nprint(result)","lang":"python","description":"Quickstart: get a style by name and use it with Pygments."},"warnings":[{"fix":"Use get_style_by_name() to retrieve a style; it raises clear errors on unknown names.","message":"Style names are case-sensitive and must match exactly as documented (e.g., 'github-dark', 'github-light'). Mismatched names raise a ValueError.","severity":"gotcha","affected_versions":"all"},{"fix":"Install Pygments: pip install Pygments","message":"The package only provides styles, not lexers or formatters. You must have Pygments installed separately.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Pygments: pip install Pygments>=2.7","message":"Some styles (e.g., 'ayu-mirage') include custom token colors that may not be fully supported by older Pygments versions. Ensure Pygments >=2.7 for best compatibility.","severity":"gotcha","affected_versions":"0.2.0+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install pygments-styles","cause":"The package is not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'pygments_styles'"},{"fix":"Run: from pygments_styles import list_styles; print(list_styles()) to see available names.","cause":"Style name is misspelled, wrong case, or the style wasn't loaded. Ensure you use an exact name from the list.","error":"ValueError: Style 'github-dark' is not a known style"},{"fix":"Use: from pygments_styles import PygmentsStylesRegistry","cause":"Wrong import path; the registry is exposed at package root, not in a submodule.","error":"ImportError: cannot import name 'PygmentsStylesRegistry' from 'pygments_styles'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}