pub struct ColorGenerator { /* private fields */ }Expand description
A color generator that produces unique colors based on a hash value
Implementations§
Source§impl ColorGenerator
impl ColorGenerator
Sourcepub fn with_base_hue(self, hue: f32) -> Self
pub fn with_base_hue(self, hue: f32) -> Self
Set the base hue (0-360)
Sourcepub fn with_saturation(self, saturation: f32) -> Self
pub fn with_saturation(self, saturation: f32) -> Self
Set the saturation (0.0-1.0)
Sourcepub fn with_lightness(self, lightness: f32) -> Self
pub fn with_lightness(self, lightness: f32) -> Self
Set the lightness (0.0-1.0)
Sourcepub fn generate_color(&self, hash: u64) -> RGB
pub fn generate_color(&self, hash: u64) -> RGB
Generate an RGB color based on a hash value
Sourcepub fn generate_color_for<T: Hash>(&self, value: &T) -> RGB
pub fn generate_color_for<T: Hash>(&self, value: &T) -> RGB
Generate an RGB color based on a hashable value
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColorGenerator
impl RefUnwindSafe for ColorGenerator
impl Send for ColorGenerator
impl Sync for ColorGenerator
impl Unpin for ColorGenerator
impl UnwindSafe for ColorGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Stylize for T
impl<T> Stylize for T
Source§fn bright_red(self) -> Styled<T>
fn bright_red(self) -> Styled<T>
Apply bright red color style to a value.
Source§fn bright_green(self) -> Styled<T>
fn bright_green(self) -> Styled<T>
Apply bright green color style to a value.
Source§fn bright_blue(self) -> Styled<T>
fn bright_blue(self) -> Styled<T>
Apply bright blue color style to a value.
Source§fn bright_yellow(self) -> Styled<T>
fn bright_yellow(self) -> Styled<T>
Apply bright yellow color style to a value.
Source§fn bright_magenta(self) -> Styled<T>
fn bright_magenta(self) -> Styled<T>
Apply bright magenta color style to a value.
Source§fn bright_cyan(self) -> Styled<T>
fn bright_cyan(self) -> Styled<T>
Apply bright cyan color style to a value.
Source§fn bright_white(self) -> Styled<T>
fn bright_white(self) -> Styled<T>
Apply bright white color style to a value.