Crate sigil_rs

Source
Expand description

A small and fast identicon generator.

sigil is compatible with Cupcake Sigil.

§Example

use sigil_rs::Theme;
use sigil_rs::Sigil;

// The default theme uses 5 rows/columns.
let theme = Theme::default();
let sigil = Sigil::generate(&theme, "username");

// The width value must be a multiple of `(rows + 1) * 2`.
let image = sigil.to_image(240);
image
    .save("username.png")
    .expect("writing to disk failed");

§Image formats

The Sigil::to_image function method returns an RgbImage. sigil enables only the PNG encoder in the image crate. If you want to use a different format, enable the relevant image feature in your Cargo.toml:

[dependencies]
image = { version = "0.25", default-features = false, features = ["bmp"] }

Structs§

Sigil
Represents a Sigil that can be rendered to an image.
Theme
Configure the way a sigil looks.

Type Aliases§

Rgb
Colour type for configuring Theme::foreground and Theme::background.
RgbImage
Sendable Rgb image buffer