pub struct ConfigBuilder { /* private fields */ }
Expand description
A builder for Config
s.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn hues(self, hues: impl AsRef<[f64]>) -> Self
pub fn hues(self, hues: impl AsRef<[f64]>) -> Self
Sets the hues to be used in the identicon. All hues should be specified in degrees in the
range [0.0, 360.0)
.
Sourcepub fn color_lightness(self, lightness: impl NormalizableRange) -> Self
pub fn color_lightness(self, lightness: impl NormalizableRange) -> Self
Sets the lightness range of colored shapes in the identicon. This should be a sub-range of
0.0..=1.0
.
Sourcepub fn grayscale_lightness(self, lightness: impl NormalizableRange) -> Self
pub fn grayscale_lightness(self, lightness: impl NormalizableRange) -> Self
Sets the lightness range of grayscale shapes in the identicon. This should be a sub-range of
0.0..=1.0
.
Sourcepub const fn color_saturation(self, saturation: f64) -> Self
pub const fn color_saturation(self, saturation: f64) -> Self
Sets the saturation range of colored shapes in the identicon, between 0 and 1.
Defaults to 0.5
.
Sourcepub const fn grayscale_saturation(self, saturation: f64) -> Self
pub const fn grayscale_saturation(self, saturation: f64) -> Self
Sets the saturation range of grayscale shapes in the identicon, between 0 and 1.
Defaults to 0.0
.
Sourcepub const fn background_color(self, color: Rgba) -> Self
pub const fn background_color(self, color: Rgba) -> Self
Sets the background color to be rendered behind the identicon.
Defaults to Rgba::white
.
Sourcepub const fn padding(self, padding: f64) -> Self
pub const fn padding(self, padding: f64) -> Self
Sets the padding surrounding the icon relative to the size of the icon.
This should be within the range [0.0, 0.5]
. Defaults to 0.08
.
Sourcepub const fn size(self, size: u32) -> Self
pub const fn size(self, size: u32) -> Self
Sets the size of the icon in pixels. Defaults to 256
.
Sourcepub fn build(self) -> Result<Config, ConfigBuilderError>
pub fn build(self) -> Result<Config, ConfigBuilderError>
Builds the Config
.
§Errors
- If hues are not within the range
[0.0, 360.0)
. - If color lightness is not within the range
0.0..=1.0
. - If grayscale lightness is not within the range
0.0..=1.0
. - If color saturation is not within the range
[0.0, 1.0]
. - If grayscale saturation is not within the range
[0.0, 1.0]
. - If padding is not within the range
[0.0, 0.5]
.