pub struct Rgb {
pub r: u8,
pub g: u8,
pub b: u8,
}Expand description
A 24-bit RGB colour. Ordered red, then green, then blue: an order for maps, not a look.
Fields§
§r: u8Red channel.
g: u8Green channel.
b: u8Blue channel.
Implementations§
Source§impl Rgb
impl Rgb
Sourcepub fn lerp(self, other: Rgb, t: f32) -> Rgb
pub fn lerp(self, other: Rgb, t: f32) -> Rgb
Linear interpolation from self (t = 0) to other (t = 1).
t is clamped to 0..=1; NaN counts as 0.
Sourcepub fn scale(self, factor: f32) -> Rgb
pub fn scale(self, factor: f32) -> Rgb
Multiplies every channel by factor (e.g. 0.5 dims by half),
saturating at 0 and 255. NaN counts as 0.
Trait Implementations§
impl Copy for Rgb
impl Eq for Rgb
Source§impl Ord for Rgb
impl Ord for Rgb
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Rgb
impl PartialOrd for Rgb
impl StructuralPartialEq for Rgb
Auto Trait Implementations§
impl Freeze for Rgb
impl RefUnwindSafe for Rgb
impl Send for Rgb
impl Sync for Rgb
impl Unpin for Rgb
impl UnsafeUnpin for Rgb
impl UnwindSafe for Rgb
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