Skip to content

Home

pyrig-badge

CI CD ProjectTester

ByteOrderMarkerFormatter CICDLinter CICDSecurityChecker CaseConflictChecker DeadCodeChecker DependencyChecker EndOfFileFormatter EndOfLineFormatter JSONFormatter JSONLinter LargeFileChecker MarkdownLinter MergeConflictChecker ModuleTestNamingChecker PythonLinter SecretsChecker SecurityChecker ShellFormatter ShellLinter SpellChecker TOMLLinter TrailingWhitespaceFormatter TypeChecker XMLLinter YAMLLinter

PackageManager Pyrigger RemoteVersionController VersionControlHookManager VersionController

DocsBuilder PackageIndex ProgrammingLanguage License


A pyrig plugin that configures a project badge.


Overview

pyrig-badge is a pyrig plugin that manages a project logo SVG, a banner containing the logo inline, and Shields.io badge data, then adds a linked banner image to the project README and this documentation landing page.

Generated assets

  • docs/assets/logo.svg contains the project logo. The plugin supplies the standard SVG root element and namespace, with default dimensions of 200 by 200 and a viewBox of 0 0 200 200 when those attributes are absent. A new file starts as an empty SVG for you to customize.
  • docs/assets/banner.svg contains the logo's SVG content inlined as a nested <svg> element, synced from docs/assets/logo.svg, so the banner renders without referencing another file. The logo is positioned within the banner's viewBox using its original dimensions, with centering offsets rounded down to integers. The banner has the same default dimensions and viewBox as the logo, and its viewBox grows to fit a larger logo.
  • docs/assets/badge.json contains the Shields.io badge configuration, including the project name, badge colors, and embedded logo markup. Its logoSvg value is synced from docs/assets/logo.svg.

Customization

During pyrig sync, Pyrig enforces the following:

  • In docs/assets/logo.svg and docs/assets/banner.svg, the root element is <svg> with xmlns="http://www.w3.org/2000/svg". Missing width, height, and viewBox attributes are filled with default values, but existing logo values are preserved.
  • In the banner's nested logo <svg>, the logo's attributes and elements are mirrored, and width, height, and viewBox match the logo's. Its x and y are the banner viewBox's minimum coordinates plus half the remaining width and height, rounded down to integers; these override any x or y set on the logo itself. The logo is drawn at its own size in the banner's viewBox units. Sync adds and updates content but never removes it, so elements or attributes deleted from the logo must also be deleted from the banner's nested <svg>.
  • The banner's viewBox width and height are raised to at least the logo's width and height, so the logo is never cropped. The viewBox's minimum coordinates and the banner's width and height are kept; the viewBox scales to them.
  • In docs/assets/badge.json, message is the project name and logoSvg is the content of logo.svg. Missing label defaults to an empty string, and missing labelColor and color default to white; existing values are preserved.

Artwork, additional SVG attributes and elements, SVG dimensions and viewBoxes, and badge labels and colors can be customized. Inserting the logo into the banner requires the logo's dimensions to be integers without units and the banner viewBox to contain exactly four whitespace-separated integers.

Usage

Add the plugin as a development dependency and run pyrig sync to regenerate the project configuration:

uv add pyrig-badge --dev
uv run pyrig sync

API Reference

For class- and method-level details, see the API reference, generated automatically from the source.