pub struct Rgba {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
Fields§
§r: u8Red channel.
g: u8Green channel.
b: u8Blue channel.
a: u8Alpha channel (255 = fully opaque).
Implementations§
Source§impl Rgba
impl Rgba
Sourcepub const fn rgb(r: u8, g: u8, b: u8) -> Self
pub const fn rgb(r: u8, g: u8, b: u8) -> Self
Builds an opaque colour from its red, green, and blue channels.
Sourcepub const fn with_alpha(self, a: u8) -> Self
pub const fn with_alpha(self, a: u8) -> Self
Returns a copy with the alpha channel replaced.
Sourcepub fn to_hex_rgb(self) -> String
pub fn to_hex_rgb(self) -> String
#rrggbb text of the colour channels (alpha dropped).
Sourcepub fn to_hex_rgba(self) -> String
pub fn to_hex_rgba(self) -> String
#rrggbbaa text including the alpha channel.
Trait Implementations§
impl Copy for Rgba
impl Eq for Rgba
impl StructuralPartialEq for Rgba
Auto Trait Implementations§
impl Forget for Rgba
impl Freeze for Rgba
impl Move for Rgba
impl RefUnwindSafe for Rgba
impl Send for Rgba
impl Sync for Rgba
impl Unpin for Rgba
impl UnsafeUnpin for Rgba
impl UnwindSafe for Rgba
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