pub struct ColorValue {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
A color value that can be manipulated and converted
Fields§
§r: u8§g: u8§b: u8§a: u8Implementations§
Source§impl ColorValue
impl ColorValue
Sourcepub fn to_hex_alpha(&self) -> String
pub fn to_hex_alpha(&self) -> String
Convert to hex string with alpha (RRGGBBAA format)
Sourcepub fn transparent(&self, percent: u8) -> Self
pub fn transparent(&self, percent: u8) -> Self
Set transparency percentage (0 = opaque, 100 = transparent)
Sourcepub fn mix(&self, other: &ColorValue, ratio: f32) -> Self
pub fn mix(&self, other: &ColorValue, ratio: f32) -> Self
Mix this color with another color
Trait Implementations§
Source§impl Clone for ColorValue
impl Clone for ColorValue
Source§fn clone(&self) -> ColorValue
fn clone(&self) -> ColorValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColorValue
impl Debug for ColorValue
Source§impl PartialEq for ColorValue
impl PartialEq for ColorValue
Source§fn eq(&self, other: &ColorValue) -> bool
fn eq(&self, other: &ColorValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ColorValue
impl StructuralPartialEq for ColorValue
Auto Trait Implementations§
impl Freeze for ColorValue
impl RefUnwindSafe for ColorValue
impl Send for ColorValue
impl Sync for ColorValue
impl Unpin for ColorValue
impl UnsafeUnpin for ColorValue
impl UnwindSafe for ColorValue
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