pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Fields§
§r: u8§g: u8§b: u8§a: u8Implementations§
Source§impl Color
impl Color
Sourcepub const fn new(r: u8, g: u8, b: u8) -> Self
pub const fn new(r: u8, g: u8, b: u8) -> Self
Creates a new Color with the specified RGB values and default alpha (255)
Sourcepub const fn with_alpha(r: u8, g: u8, b: u8, a: u8) -> Self
pub const fn with_alpha(r: u8, g: u8, b: u8, a: u8) -> Self
Creates a new Color with the specified RGBA values
pub fn from_hex(hex: &str) -> Self
pub fn to_u32(&self, include_alpha: bool) -> u32
pub fn from_u32(color: u32) -> Self
pub fn mix_alpha(&self, alpha: u8) -> Self
pub fn mix(&self, other: &Color, alpha: u8) -> Self
pub fn invert(&self) -> 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