pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
An RGBA color with 8 bits per channel.
Fields§
§r: u8Red channel (0–255).
g: u8Green channel (0–255).
b: u8Blue channel (0–255).
a: u8Alpha channel (0 = fully transparent, 255 = fully opaque).
Implementations§
Source§impl Color
impl Color
Sourcepub const TAB_ORANGE: Color
pub const TAB_ORANGE: Color
Tableau-10 orange (#F28E2B).
Sourcepub const TAB_PURPLE: Color
pub const TAB_PURPLE: Color
Tableau-10 purple (#B07AA1).
Sourcepub const TRANSPARENT: Color
pub const TRANSPARENT: Color
Fully transparent black.
Sourcepub const TABLEAU_10: [Color; 10]
pub const TABLEAU_10: [Color; 10]
The complete Tableau-10 categorical palette, in canonical order.
Sourcepub const fn new(r: u8, g: u8, b: u8, a: u8) -> Color
pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Color
Creates a new color from individual RGBA components.
Sourcepub const fn rgb(r: u8, g: u8, b: u8) -> Color
pub const fn rgb(r: u8, g: u8, b: u8) -> Color
Creates a fully opaque color from RGB components (alpha = 255).
Sourcepub fn with_alpha(self, a: u8) -> Color
pub fn with_alpha(self, a: u8) -> Color
Returns a copy of this color with the alpha channel set to a.
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 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