pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Expand description
Linear RGBA color, all components in [0, 1].
Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
pub const BLACK: Self
pub const WHITE: Self
pub const RED: Self
pub const GREEN: Self
pub const BLUE: Self
pub const YELLOW: Self
pub const CYAN: Self
pub const MAGENTA: Self
pub const TRANSPARENT: Self
pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
pub fn from_srgb(r: u8, g: u8, b: u8) -> Self
pub fn from_srgba(r: u8, g: u8, b: u8, a: u8) -> Self
pub fn from_hex(hex: u32) -> Self
pub fn to_rgba_bytes(self) -> [u8; 4]
pub fn lerp(self, other: Self, t: f32) -> Self
pub fn premultiply_alpha(self) -> Self
pub fn with_alpha(self, a: f32) -> Self
pub fn luminance(self) -> f32
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