pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Expand description
Four-component RGBA color used by UI, plotting, overlays, and ordinary normalized render colors.
Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
Sourcepub fn to_u32(self) -> u32
pub fn to_u32(self) -> u32
Pack to 0xRRGGBBAA, clamping each component and rounding to nearest.
Sourcepub const fn new_from_u32(rgba: u32) -> Self
pub const fn new_from_u32(rgba: u32) -> Self
Unpack one 0xRRGGBBAA word.
pub const fn with_alpha(self, alpha: f32) -> Self
pub const fn lerp(self, other: Self, fraction: f32) -> Self
pub fn clamp(self) -> Self
pub const fn to_array(self) -> [f32; 4]
pub const fn accent() -> Self
pub const fn accent_hover() -> Self
pub const fn success() -> Self
pub const fn warning() -> Self
pub const fn error() -> Self
pub const fn orange() -> Self
pub const fn purple() -> Self
pub const fn cyan() -> Self
pub const fn pink() -> Self
pub const fn yellow() -> Self
pub const fn text_primary() -> Self
Trait Implementations§
Source§impl AddAssign for Color
impl AddAssign for Color
Source§fn add_assign(&mut self, rhs: Color)
fn add_assign(&mut self, rhs: Color)
Performs the
+= operation. Read moreimpl Copy for Color
Source§impl DivAssign<f32> for Color
impl DivAssign<f32> for Color
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moreSource§impl MulAssign for Color
impl MulAssign for Color
Source§fn mul_assign(&mut self, rhs: Color)
fn mul_assign(&mut self, rhs: Color)
Performs the
*= operation. Read moreSource§impl MulAssign<f32> for Color
impl MulAssign<f32> for Color
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreimpl StructuralPartialEq for Color
Auto Trait Implementations§
impl Forget for Color
impl Freeze for Color
impl Move 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