Struct bottomless_pit::colour::Colour
source · pub struct Colour { /* private fields */ }Expand description
A struct containing RGBA Colours (spelled properly) with some predefind colour consts
Implementations§
source§impl Colour
impl Colour
pub const WHITE: Self = _
pub const BLACK: Self = _
pub const RED: Self = _
pub const GREEN: Self = _
pub const BLUE: Self = _
pub const YELLOW: Self = _
pub const ORANGE: Self = _
pub const PINK: Self = _
pub const BROWN: Self = _
sourcepub fn from_hex(hex_str: &str) -> Result<Self, ParseIntError>
pub fn from_hex(hex_str: &str) -> Result<Self, ParseIntError>
Takes a hex string like #805E4E and turns into a colour. Can fail if an
invaild string is provided
sourcepub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self
pub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self
Creates a colour from seperate values beteen 0.0 and 255.0
sourcepub fn linear_interpolation(start: Colour, end: Colour, fraction: f32) -> Self
pub fn linear_interpolation(start: Colour, end: Colour, fraction: f32) -> Self
Interpolates between two colours by the specified fraction which should be between 1.0 and 0.0
Trait Implementations§
source§impl PartialEq for Colour
impl PartialEq for Colour
impl Copy for Colour
impl StructuralPartialEq for Colour
Auto Trait Implementations§
impl RefUnwindSafe for Colour
impl Send for Colour
impl Sync for Colour
impl Unpin for Colour
impl UnwindSafe for Colour
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