shields.rs
A high-performance badge rendering engine written in Rust, supporting SVG output and font parsing. This project is designed for developers and services that require fast, customizable, and reliable badge generation.
🎯 Pixel-Perfect Consistency with shields.io
Our goal is to achieve pixel-perfect, 100% identical rendering results to shields.io. We utilize precisely the same text length calculation data to ensure full consistency, while delivering significantly improved efficiency.
🟢 Bitwise-Identical SVG Output
Not only do we pursue pixel-level similarity, but we also guarantee that the generated SVG string is bitwise-identical to the output returned by shields.io for the same parameters. This ensures absolute compatibility and consistency for all use cases.
🎨 Supported Styles
We support all major badge styles (except "for the badge"): flat, flat-square, plastic, and social.
Installation
Prerequisites
- Rust (edition 2024 or later)
- Cargo package manager (comes with Rust)
Build
Clone the repository and build the project:
Run
To run the badge rendering engine:
Usage Example
The library provides a chainable API for customizing badges. You can set the label, message, color, and other properties using method chaining:
use Badge;
Advanced Example
A more comprehensive example demonstrating advanced customization:
use Badge;
Contributing
Contributions are welcome! To get started:
- Fork the repository on GitHub.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear messages.
- Open a pull request describing your changes.
- For issues, please use the GitHub Issues page.
Before submitting a PR, ensure all tests pass:
License
This project is licensed under the MIT License. See the LICENSE file for details.
Community & Contact
- GitHub: https://github.com/Jannchie/shields
- Documentation: https://docs.rs/shields
- Author: Jannchie (jannchie@gmail.com)