pub struct Color {}
Expand description
A utility struct for color-related operations.
Implementations§
Source§impl Color
impl Color
Sourcepub fn luminance_from_rgba(rgba: &[u8; 4]) -> f64
pub fn luminance_from_rgba(rgba: &[u8; 4]) -> f64
Calculates the luminance of an RGBA color.
§Arguments
rgba
- A reference to a 4-element array representing a color in RGBA format (0–255 range).
§Returns
- A
f64
value representing the luminance (brightness) of the color, normalized to the 0.0–1.0 range.
§Example
use typistapp::color::Color;
let luminance = Color::luminance_from_rgba(&[255, 255, 255, 255]);
assert!(luminance > 0.9);
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more