You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
🟢 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.
⚡️ Fast & Efficient
Over 10x faster than the Node.js badge-maker library, this Rust implementation is optimized for speed and efficiency. It can generate badges in microseconds, making it suitable for high-performance applications and services.
🎨 Supported All Styles & Logos
We support all major badge styles: flat, flat-square, plastic, social and for-the-badge. Each style can be customized with various properties such as label, message, color, logo, and more. You can easily use Simple Icons slugs to set logos for your badges, and we also support custom logos with SVG strings.
Benchmark: Rust vs Node.js badge-maker
Library
Language
Time per badge
Unit
shields
Rust
4.4796
µs
badge-maker
Node.js
49.5232
µs
Installation
cargo add shields
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 shields::builder::Badge;fnmain(){// Simple flat badgelet badge = Badge::flat().label("test").message("passing").build();println!("{}", badge);// Flat badge with custom colorslet badge = Badge::plastic().label("version").message("1.0.0").label_color("#555").message_color("#4c1").build();println!("{}", badge);// Plastic badge with logolet badge = Badge::social().label("github").message("stars").logo("github").link("https://github.com/user/repo").extra_link("https://github.com/user/repo/stargazers").build();println!("{}", badge);}
License
This project is licensed under the MIT License. See the LICENSE file for details.