Struct primitives::foundation::colorspace::Color
source · [−]Expand description
Basic color representation
Fields
red: f32
Red component
green: f32
Green component
blue: f32
Blue component
alpha: f32
Alpha component
Implementations
sourceimpl Color
impl Color
sourcepub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self
Create color with floating point components
sourcepub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Self
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Self
Create solid color with using hsl color space
sourcepub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Self
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Self
Create solid color with using hsl color space and alpha component
sourcepub fn hsv(hue: f32, saturation: f32, value: f32) -> Self
pub fn hsv(hue: f32, saturation: f32, value: f32) -> Self
Create solid color with using hsv color space
sourcepub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Self
pub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Self
Create solid color with using hsv color space and alpha component
sourcepub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Self
pub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Self
Create solid color with using cmyk color space
sourcepub fn cmyka(cyan: f32, magenta: f32, yellow: f32, key: f32, alpha: f32) -> Self
pub fn cmyka(cyan: f32, magenta: f32, yellow: f32, key: f32, alpha: f32) -> Self
Create solid color with using cmyk color space and alpha component
sourcepub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Self
pub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Self
Create solid color with using cmy color space
sourcepub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Self
pub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Self
Create solid color with using cmy color space and alpha component
sourcepub fn RGB(red: u8, green: u8, blue: u8) -> Self
👎 Deprecated
pub fn RGB(red: u8, green: u8, blue: u8) -> Self
Create solid color with using rgb color space
sourcepub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Self
👎 Deprecated
pub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Create solid color with using lab rgb space and alpha component
sourcepub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Self
👎 Deprecated
pub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Self
Create solid color with using hsl color space
sourcepub fn HSV(hue: f32, saturation: f32, value: f32) -> Self
👎 Deprecated
pub fn HSV(hue: f32, saturation: f32, value: f32) -> Self
Create solid color with using hsv color space
Trait Implementations
sourceimpl GetAlpha<Color> for Color
impl GetAlpha<Color> for Color
sourcefn get_opacity(&self) -> f32
fn get_opacity(&self) -> f32
Retrieve the alpha component as opacity
sourcefn get_transparency(&self) -> f32
fn get_transparency(&self) -> f32
Retrieve 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
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