#badge #svg

badgers

Simple badge generator

3 stable releases

1.2.0 Jan 18, 2023
1.1.0 Dec 18, 2022
1.0.0 Sep 28, 2022

#170 in Images

Download history 121/week @ 2023-01-25 24/week @ 2023-02-01 29/week @ 2023-02-08 18/week @ 2023-02-15 9/week @ 2023-02-22 53/week @ 2023-03-01 13/week @ 2023-03-08 42/week @ 2023-03-15 15/week @ 2023-03-22 18/week @ 2023-03-29 7/week @ 2023-04-05 145/week @ 2023-04-12 5/week @ 2023-04-19 45/week @ 2023-04-26 45/week @ 2023-05-03 22/week @ 2023-05-10

118 downloads per month

Custom license

390KB
160 lines

Badgers - Create SVG Badges

Hits-of-Code Rust dependency status Crates.io docs.rs License

This is a Rust crate to generate simple SVG badges to be used e.g. in README files. The subject, status and color of the badge can be configured.

Example

use badgers::{BadgeOptions, Badge};

let options = BadgeOptions {
    subject: "docs".to_owned(),
    status: "0.5.3".to_owned(),
    color: "#4d76ae".to_owned(),
};
let badge = Badge::new(options).unwrap();
let svg = badge.to_svg();

Origin Story

This is a fork of the badge crate in order to replace the now deprecated rusttype crate. rusttype was replaced by ab_glyph as suggested in the rustsec advisory.

This fork was created since the original badge crate is no longer maintained and the code has been removed from the originating repository: rust-lang/docs.rs@94f3bba

While trying to be a 1:1 replacement of badge, either my lack of deep understanding of the problem space or minor differences between rusttype and ab_glyph required some 1 pixel changes in the testcases: vbrandl/badgers@9c8cdb9

This fork exists mostly for personal use in vbrandl/hoc but feel free to give it a try.

Dependencies

~1MB
~22K SLoC