Skip to main content

Crate badge_maker_rs

Crate badge_maker_rs 

Source
Expand description

Rust badge renderer targeting Shields-compatible badge output.

Start with BadgeOptions::new and render with make_badge.

use badge_maker_rs::{BadgeOptions, Color, Style, make_badge};

let svg = make_badge(
    &BadgeOptions::new("passing")
        .label("build")
        .color("brightgreen".parse::<Color>().unwrap())
        .style(Style::Flat)
        .build(),
)
.unwrap();

assert!(svg.starts_with("<svg "));
assert!(svg.contains("aria-label=\"build: passing\""));

The public API is intentionally Rust-first. The compatibility target is the final rendered badge image: pixel-equivalent output matters more than SVG source parity, and JavaScript-specific API shape is out of scope.

Structs§

BadgeOptions
Badge rendering options.
BadgeOptionsBuilder
Use builder syntax to set the inputs and finish with build().
ParseColorError
Failed to parse a color string into Color.

Enums§

Color
Strongly-typed badge color input.
Error
Rendering errors returned by make_badge.
NamedColor
Documented Shields named colors and semantic aliases.
Style
Badge visual style. Visual style used for badge rendering.

Functions§

make_badge
Renders a complete SVG badge document from BadgeOptions.