pub struct Color { /* private fields */ }Expand description
A color represented by red, green, blue, and alpha channels in the range 0.0 to 1.0.
Implementations§
Source§impl Color
Implements methods for Color.
impl Color
Implements methods for Color.
Sourcepub fn to_css_rgba(&self) -> String
pub fn to_css_rgba(&self) -> String
Sourcepub fn write_css_rgba(&self, buffer: &mut String)
pub fn write_css_rgba(&self, buffer: &mut String)
Writes the CSS rgba() representation into the provided buffer.
Reuses the caller’s allocation so per-frame color conversions in tight
render loops avoid the format! machinery and repeated allocation.
§Arguments
&mut String- The buffer to append the CSS color string to.
Sourcepub fn transparent() -> Color
pub fn transparent() -> Color
Source§impl Color
impl Color
pub fn get_red(&self) -> f64
pub fn get_mut_red(&mut self) -> &mut f64
pub fn set_red(&mut self, val: f64) -> &mut Self
pub fn get_green(&self) -> f64
pub fn get_mut_green(&mut self) -> &mut f64
pub fn set_green(&mut self, val: f64) -> &mut Self
pub fn get_blue(&self) -> f64
pub fn get_mut_blue(&mut self) -> &mut f64
pub fn set_blue(&mut self, val: f64) -> &mut Self
pub fn get_alpha(&self) -> f64
pub fn get_mut_alpha(&mut self) -> &mut f64
pub fn set_alpha(&mut self, val: f64) -> &mut Self
Trait Implementations§
impl Copy for Color
Source§impl PartialOrd for Color
impl PartialOrd 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