Struct random_color::RandomColor
source · pub struct RandomColor {
pub hue: Option<ColorInformation>,
pub luminosity: Option<Luminosity>,
pub seed: Option<u64>,
pub alpha: Option<f32>,
pub color_dictionary: Option<ColorDictionary>,
}
Fields§
§hue: Option<ColorInformation>
Can take values of Color
enum.
luminosity: Option<Luminosity>
Can take values of Luminosity
enum.
seed: Option<u64>
Can take any value of i64
.
alpha: Option<f32>
Can take values f32
from 0 to 1.
color_dictionary: Option<ColorDictionary>
Optional, bring your own dictionary
Implementations§
source§impl RandomColor
impl RandomColor
sourcepub fn hue(&mut self, hue: Color) -> &mut RandomColor
pub fn hue(&mut self, hue: Color) -> &mut RandomColor
Sets RandomColor.hue
colorspace.
sourcepub fn luminosity(&mut self, luminosity: Luminosity) -> &mut RandomColor
pub fn luminosity(&mut self, luminosity: Luminosity) -> &mut RandomColor
Sets RandomColor.luminosity
.
sourcepub fn seed<T: Seed>(&mut self, seed: T) -> &mut RandomColor
pub fn seed<T: Seed>(&mut self, seed: T) -> &mut RandomColor
Sets RandomColor.seed
used to generate a color.
sourcepub fn alpha(&mut self, alpha: f32) -> &mut RandomColor
pub fn alpha(&mut self, alpha: f32) -> &mut RandomColor
Sets RandomColor.aplha
to the value passed if it’s lower than 1.0.
sourcepub fn random_alpha(&mut self) -> &mut RandomColor
pub fn random_alpha(&mut self) -> &mut RandomColor
Sets RandomColor.alpha
to None, aka random.
pub fn dictionary(&mut self, dictionary: ColorDictionary) -> &mut RandomColor
pub fn to_hsv_array(&self) -> [u32; 3]
pub fn to_rgb_string(&self) -> String
pub fn to_rgba_string(&self) -> String
pub fn to_rgb_array(&self) -> [u8; 3]
pub fn to_hsl_string(&self) -> String
pub fn to_hsla_string(&self) -> String
pub fn to_hsl_array(&self) -> [u32; 3]
pub fn to_hex(&self) -> String
Trait Implementations§
source§impl Clone for RandomColor
impl Clone for RandomColor
source§fn clone(&self) -> RandomColor
fn clone(&self) -> RandomColor
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RandomColor
impl Debug for RandomColor
source§impl Default for RandomColor
impl Default for RandomColor
source§impl PartialEq for RandomColor
impl PartialEq for RandomColor
source§fn eq(&self, other: &RandomColor) -> bool
fn eq(&self, other: &RandomColor) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for RandomColor
Auto Trait Implementations§
impl RefUnwindSafe for RandomColor
impl Send for RandomColor
impl Sync for RandomColor
impl Unpin for RandomColor
impl UnwindSafe for RandomColor
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