pub struct Color { /* private fields */ }Implementations§
Source§impl Color
impl Color
pub const fn black(space: ColorSpace) -> Color
pub const fn white(space: ColorSpace) -> Color
pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color
pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Color
pub const fn from_hsl(h: f32, s: f32, l: f32) -> Color
pub const fn from_hsla(h: f32, s: f32, l: f32, a: f32) -> Color
pub const fn from_hsv(h: f32, s: f32, v: f32) -> Color
pub const fn from_hsva(h: f32, s: f32, v: f32, a: f32) -> Color
pub const fn from_lab(l: f32, a: f32, b: f32) -> Color
pub const fn from_laba(l: f32, a: f32, b: f32, alpha: f32) -> Color
pub fn with_alpha(self, alpha: f32) -> Color
pub fn opaque(self) -> Color
pub fn transparent(self) -> Color
pub fn check_alpha(self) -> Option<f32>
pub fn alpha(&self) -> f32
pub fn as_bytes(self) -> [u8; 4]
pub fn components_3(&self) -> &[f32; 3]
pub fn components_3_mut(&mut self) -> &mut [f32; 3]
pub fn components_4(&self) -> &[f32; 4]
pub fn components_4_mut(&mut self) -> &mut [f32; 4]
Sourcepub fn convert(&mut self, space: ColorSpace)
pub fn convert(&mut self, space: ColorSpace)
Converts this Color into a different ColorSpace in-place.
pub fn to_rgb(&self) -> Color
pub fn to_hsv(&self) -> Color
pub fn to_hsl(&self) -> Color
pub fn to_lab(&self) -> Color
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more