skillfed

anybadge

Simple, flexible badge generator for project badges.

anybadge v1.16.0 1.9M downloads/30d#3,436 on PyPI400
Permissive license Active released

What it is and what it does

anybadge is a Python library and CLI tool for generating SVG badge images with dynamic coloring based on threshold rules. It lets you create badges by specifying a label, value, and a set of thresholds that map numeric ranges to colors—so a pylint score of 2.22 can automatically render red, while higher scores render green. The package supports both named colors (from Mozilla's CSS color keywords) and hex color codes.

You can use it either by importing into Python code or by running commands directly from the shell. It's designed for projects that need badge generation without calling external services, making it useful for internal development, CI/CD pipelines, or environments where external badge services are unavailable or undesirable. The single dependency (packaging) and pure-Python wheel keep installation friction minimal.

Use it for:

  • Generate pylint or code-quality score badges that change color based on thresholds in CI/CD pipelines.
  • Create custom metric badges for internal dashboards or README files without relying on external badge services.
  • Automate badge generation in build scripts to reflect real-time project health metrics.
  • Generate badges for documentation completeness or API compliance status with threshold-driven colors.
  • Build badges with both named colors and custom hex values for consistent project branding.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates SVG badge images with configurable thresholds and colors, usable as a Python library or command-line tool for adding badges to projects.

Yes. anybadge is a lightweight, actively maintained tool with no security issues, permissive licensing, and low install friction. It solves a specific, real problem—generating SVG badges with threshold-based coloring—and is well-suited for CI/CD integration, internal projects, or any scenario where you need badge generation without external dependencies.

Install

anybadge on PyPI

pip

pip install anybadge

uv

uv add anybadge

poetry

poetry add anybadge

Installing anybadge

Before you install

Low friction: pure Python wheel with a single runtime dependency (packaging). Active maintenance with recent release (2025-01-11) and no known vulnerabilities.

License in practice

MIT license (permissive): you can use, modify, and distribute anybadge freely in commercial and private projects with minimal restrictions.

Quickstart

pip install anybadge

import anybadge

thresholds = {2: 'red', 4: 'orange', 8: 'yellow', 10: 'green'}
badge = anybadge.Badge('pylint', 2.22, thresholds=thresholds)
badge.write_badge('pylint.svg')

Verify before relying

  • Whether pre-built badge templates (e.g., 'pylint') cover your specific metrics or if custom thresholds are always required.
  • Performance characteristics when generating many badges in batch or in high-frequency CI/CD pipelines.
  • Specific use-case coverage for test coverage badges or other common metrics beyond the documented examples.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — packaging
Maintenance actively maintained — 580 days since the last release
Last repo commit
First released
Downloads 1,914,191/month — #3,436 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: anybadge-1.16.0-py3-none-any.whl

License :: OSI Approved :: MIT License

Tags

svg badge generatorproject badge creationthreshold-based badge coloringbadge generation toolpython badge librarycommand line badge makerci status badge
badge-generationsvgci-cd

More Build Tools packages