Struct components::prelude::Color
[−]Expand description
Basic color representation
Fields
red: f32
Red component
green: f32
Green component
blue: f32
Blue component
alpha: f32
Alpha component
Implementations
impl Color
impl Color
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Color
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Color
Create color with floating point components
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
Create solid color with using hsl color space
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
Create solid color with using hsl color space and alpha component
pub fn hsv(hue: f32, saturation: f32, value: f32) -> Color
pub fn hsv(hue: f32, saturation: f32, value: f32) -> Color
Create solid color with using hsv color space
pub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Color
pub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Color
Create solid color with using hsv color space and alpha component
pub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Color
pub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Color
Create solid color with using cmyk color space
pub fn cmyka(
cyan: f32,
magenta: f32,
yellow: f32,
key: f32,
alpha: f32
) -> Color
pub fn cmyka(
cyan: f32,
magenta: f32,
yellow: f32,
key: f32,
alpha: f32
) -> Color
Create solid color with using cmyk color space and alpha component
pub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Color
pub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Color
Create solid color with using cmy color space
pub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Color
pub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Color
Create solid color with using cmy color space and alpha component
pub fn RGB(red: u8, green: u8, blue: u8) -> Color
👎 Deprecated
pub fn RGB(red: u8, green: u8, blue: u8) -> Color
Create solid color with using rgb color space
pub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Color
👎 Deprecated
pub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Color
Create solid color with using lab rgb space and alpha component
pub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Color
👎 Deprecated
pub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Color
Create solid color with using hsl color space
pub fn HSV(hue: f32, saturation: f32, value: f32) -> Color
👎 Deprecated
pub fn HSV(hue: f32, saturation: f32, value: f32) -> Color
Create solid color with using hsv color space
Trait Implementations
impl GetAlpha<Color> for Color
impl GetAlpha<Color> for Color
fn get_opacity(&self) -> f32
fn get_opacity(&self) -> f32
Retrieve the alpha component as opacity
fn get_transparency(&self) -> f32
fn get_transparency(&self) -> f32
Retrieve the alpha component as transparency
impl SetAlpha<Color> for Color
impl SetAlpha<Color> for Color
fn set_opacity(&mut self, opacity: f32) -> &Color
fn set_opacity(&mut self, opacity: f32) -> &Color
Set the alpha component as opacity
fn set_transparency(&mut self, transparency: f32) -> &Color
fn set_transparency(&mut self, transparency: f32) -> &Color
Set the alpha component as transparency
impl ColorTransition for Color
impl Copy for Color
impl NonRadialSpace for Color
impl NonSaturationSpace for Color
impl StructuralPartialEq for Color
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
impl<C> AdjustHue for C where
C: Clone + GetHue + SetHue,
impl<C> AdjustHue for C where
C: Clone + GetHue + SetHue,
fn adjust_hue(self, delta: f32) -> C
fn adjust_hue(self, delta: f32) -> C
Adjust hue component of color with delta
fn complement(self) -> Self
fn complement(self) -> Self
Rotate hue component with 180 degrees
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<Fr, To> FromColor<Fr> for To where
To: From<Color>,
Fr: Into<Color>,
impl<Fr, To> FromColor<Fr> for To where
To: From<Color>,
Fr: Into<Color>,
fn from_color(from_color: Fr) -> To
fn from_color(from_color: Fr) -> To
Convert from color
impl<C> GetHue for C where
C: NonRadialSpace,
impl<C> GetHue for C where
C: NonRadialSpace,
impl<C> GetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
impl<C> GetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
fn get_hsl_saturation(self) -> f32
fn get_hsl_saturation(self) -> f32
Retrieve hsl saturation
fn get_hsv_saturation(self) -> f32
fn get_hsv_saturation(self) -> f32
Set hsv saturation
impl<C> Grayscale for C where
C: Saturate,
impl<C> Grayscale for C where
C: Saturate,
fn grayscale(self) -> Self
fn grayscale(self) -> Self
Desaturate the color to grayscale
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
fn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<C> Invert for C where
C: ColorTransition,
impl<C> Invert for C where
C: ColorTransition,
fn invert(self) -> C
fn invert(self) -> C
Invert color
impl<T> Pointable for T
impl<T> Pointable for T
impl<C> Saturate for C where
C: Clone + GetRadialSaturation + SetRadialSaturation,
impl<C> Saturate for C where
C: Clone + GetRadialSaturation + SetRadialSaturation,
fn desaturate(self, delta: f32) -> Self
fn desaturate(self, delta: f32) -> Self
Desaturate the color with delta
impl<C> SetHue for C where
C: NonRadialSpace,
impl<C> SetHue for C where
C: NonRadialSpace,
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<C> SetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
impl<C> SetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
fn set_hsl_saturation(&mut self, saturation: f32) -> C
fn set_hsl_saturation(&mut self, saturation: f32) -> C
Retrieve hsl saturation
fn set_hsv_saturation(&mut self, saturation: f32) -> C
fn set_hsv_saturation(&mut self, saturation: f32) -> C
Set hsv saturation
impl<C> ToHexString for C where
C: Into<RgbColor> + Clone,
impl<C> ToHexString for C where
C: Into<RgbColor> + Clone,
fn to_hex_string(&self) -> String
fn to_hex_string(&self) -> String
Represents a color as a hexadecimal string