pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
An sRGB color with alpha.
Fields§
§r: u8§g: u8§b: u8§a: u8Implementations§
Source§impl Color
impl Color
Sourcepub const fn hex(value: u32) -> Color
pub const fn hex(value: u32) -> Color
Create a color from a number, intended to be written as a hex literal.
let orange = Color::hex(0xff6137);
assert_eq!(orange, Color::rgb(255, 97, 55));Sourcepub fn with_alpha(self, alpha: f32) -> Color
pub fn with_alpha(self, alpha: f32) -> Color
Creates a new color using the existing color and the given linear alpha value given as a float.
Sourcepub fn from_linear(value: Vec4) -> Color
pub fn from_linear(value: Vec4) -> Color
Create a new Color from a linear RGB color.
Source§impl Color
impl Color
pub const RED: Color
pub const GREEN: Color
pub const BLUE: Color
pub const YELLOW: Color
pub const CYAN: Color
pub const FUCHSIA: Color
pub const WHITE: Color
pub const GRAY: Color
pub const BLACK: Color
pub const CORNFLOWER_BLUE: Color
pub const REBECCA_PURPLE: Color
Trait Implementations§
impl Copy for Color
impl Eq 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