pub struct Color { /* private fields */ }
Expand description
An RGBA color.
Implementations§
Source§impl Color
impl Color
pub const BLACK: Self
pub const GRAY: Self
pub const WHITE: Self
pub const RED: Self
pub const GREEN: Self
pub const BLUE: Self
pub const CYAN: Self
pub const MAGENTA: Self
pub const YELLOW: Self
Sourcepub const fn new(red: f64, green: f64, blue: f64, alpha: f64) -> Self
pub const fn new(red: f64, green: f64, blue: f64, alpha: f64) -> Self
Creates a new color with the given RGBA components.
Sourcepub const fn with_rgb(red: f64, green: f64, blue: f64) -> Self
pub const fn with_rgb(red: f64, green: f64, blue: f64) -> Self
Creates a new color with the given RGB components and alpha 1.
Sourcepub const fn with_grayscale(gray: f64) -> Self
pub const fn with_grayscale(gray: f64) -> Self
Creates a new color with the given grayscale value and alpha 1.
Sourcepub fn with_hsva(hue: Angle, saturation: f64, value: f64, alpha: f64) -> Self
pub fn with_hsva(hue: Angle, saturation: f64, value: f64, alpha: f64) -> Self
Creates a new color with the given HSV value and alpha.
Sourcepub fn with_hsv(hue: Angle, saturation: f64, value: f64) -> Self
pub fn with_hsv(hue: Angle, saturation: f64, value: f64) -> Self
Creates a new color with the given HSV value.
Sourcepub fn invert_rgb(self) -> Self
pub fn invert_rgb(self) -> Self
The inverted color with the same alpha.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
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