pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Expand description
A color value with red, green, blue, and alpha channels, each in [0.0, 1.0].
Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
Sourcepub const TRANSPARENT: Self
pub const TRANSPARENT: Self
Fully transparent black.
Sourcepub const fn rgb(r: f32, g: f32, b: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
Creates an opaque color from RGB components in [0.0, 1.0].
Sourcepub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self
Creates a color from RGBA components in [0.0, 1.0].
Sourcepub fn with_alpha(self, a: f32) -> Self
pub fn with_alpha(self, a: f32) -> Self
Returns a copy of this color with the alpha channel replaced by a.
Trait Implementations§
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