Crate plot_icon

Source
Expand description

Generates 19-circle identicons in png and in svg format from &[u8] input slice. Slice length could be arbitrary, as identicon generation starts with input hashing. Typical input is a public key.

Identicon example:

The identicon color scheme and elements arrangement follow the published javascript code for polkadot identicon generation. This crate is intended mainly for use by Signer.

Crate also supports generation of identicon-like images with pre-set colors in RGBA format, mainly for test purposes.

Feature "pix" supports generation of png images, feature "vec" - generation of svg images. Both are made available by default.

Re-exports§

pub use colors::Color;

Modules§

circles
colors

Enums§

IdenticonError
Errors in png identicon generation

Constants§

EMPTY_PNG
Static 30x30 transparent png, for rare cases when the identicon generation fails or when the data to generate identicon is unavailable

Functions§

generate_png
Polkadot identicon png data in u8 vector format, from &[u8] input slice
generate_png_scaled_custom
Data for small-sized identicon png, from &[u8] input slice, larger image is generated first and then scaled down to fit the required size
generate_png_scaled_custom_with_colors
Data for small-sized identicon png, with given colors, larger image is generated first and then scaled down to fit the required size
generate_png_scaled_default
Data for small-sized identicon png, from &[u8] input slice, with default settings used for Signer app
generate_png_with_colors
Polkadot identicon png data in u8 vector format, with given colors
generate_svg
Identicon svg::Document data, from &[u8] input slice
generate_svg_with_colors
Identicon svg::Document data, with given colors