9 releases

0.3.1 Jun 21, 2022
0.3.0 Jun 20, 2022
0.2.1 Jan 13, 2022
0.1.4 Jun 4, 2021
0.1.2 Jan 11, 2021

#244 in Images

Download history 1/week @ 2023-12-04 1/week @ 2023-12-11 8/week @ 2023-12-18 8/week @ 2024-01-22 27/week @ 2024-02-19 24/week @ 2024-02-26 25/week @ 2024-03-04 43/week @ 2024-03-11 13/week @ 2024-03-18

105 downloads per month
Used in subweight-web

MIT license



Crates.io MIT licensed

Links are generated from cargo, view on docs page

A fast and accurate badge maker for services like shields.io. Verified to match badge-maker 1-to-1 with side by rendering tests*.







*This library differs in that it generates unique IDs for the svg so it can be directly embedded in websites (such as in this doc). So a diff between the outputs will not match. We only claim the visual outputs match which is whats important.


This library is meant to be the Rust version of badge-maker. The use cases for this library are two-fold:

  • Rusty badge maker for any rust-based shields.io clones
  • WASM based npm package for a speed increase over the node based version (numbers coming when optimizations are finished)

Current todos

  1. Better code coverage
  2. Optimize text formatters
  3. Fix errors. The output is ugly.
  4. Other badge styles (requires a custom renderer)



use badge_maker::BadgeBuilder;

let svg = BadgeBuilder::new()

println!("{}", svg);

# Ok::<(), badge_maker::error::Error>(())


This library is still in its infancy. Tests and documentation are being added whenever possible. If you are interested in contributing then check out the repository. The API is likely to change. If you see something you think would work better than the way I've done it open an issue, I'd love to hear your suggestions.

We support different styles, colors, logos, and links. The badge builder accepts all of these options with the field() and an alternate method of field_parse() which accepts a string and will attempt parse the text as a valid field.


This is a library but you can use it with a simple cli tool as well.



cargo install badge-maker --features cli


badge-maker example badge -c informational -l #282828 -s flat

on windows the # needs to be handled specially

badge-maker example badge -c informational -l "#282828" -s flat


We currently support hex colors 3 and 6 chars long, named colors and their alias's, and RGB color inputs. These can be constructed with their enum variants or using the ...parse() methods.


use badge_maker::BadgeBuilder;
use badge_maker::color::{Color, AliasColor, NamedColor};

let svg = BadgeBuilder::new()
    // by enums
    .color(Color::Rgb(10, 200, 50))
    // or parsing
    .color_parse("rgb(10, 200, 50)")

# Ok::<(), badge_maker::error::Error>(())


Supported. Others coming soon. See Style enum for choices when building or use the string literals.

  • Flat example_flat
  • Plastic example_plastic
  • FlatSquare example_flat_square
  • ForTheBadge
  • Social
use badge_maker::{BadgeBuilder, Style};

let svg = BadgeBuilder::new()
  .style(Style::Plastic) // example of using typed input
  .style_parse("plastic") // example of parsing to derive

println!("{}", svg);

# Ok::<(), badge_maker::error::Error>(())

Adding links to the natively rendered badge supported. This is great if you need to embed the svg directly. However, on a website like the rust docs they may show the underline. To solve this, your third-party api that renders the badges should wrap the svg in markdown [![name for readers](link to api endpoint)](link when clicked).


use badge_maker::BadgeBuilder;

let logo_url = "https://upload.wikimedia.org/wikipedia/commons/\

let svg = BadgeBuilder::new()

# Ok::<(), badge_maker::error::Error>(())


~109K SLoC