#[repr(C)]pub struct Luma<S = Srgb, T = f32> where
T: Component,
S: LumaStandard, {
pub luma: T,
pub standard: PhantomData<S>,
}
Expand description
Luminance.
Luma is a purely gray scale color space, which is included more for
completeness than anything else, and represents how bright a color is
perceived to be. It’s basically the Y
component of CIE
XYZ. The lack of any form of hue representation limits
the set of operations that can be performed on it.
Fields
luma: T
The lightness of the color. 0.0 is black and 1.0 is white.
standard: PhantomData<S>
The kind of RGB standard. sRGB is the default.
Implementations
sourceimpl<S, T> Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Luma<S, T> where
T: Component,
S: LumaStandard,
sourcepub fn into_format<U>(self) -> Luma<S, U> where
U: Component + FromComponent<T>,
pub fn into_format<U>(self) -> Luma<S, U> where
U: Component + FromComponent<T>,
Convert into another component type.
sourcepub fn from_format<U>(color: Luma<S, U>) -> Self where
U: Component,
T: FromComponent<U>,
pub fn from_format<U>(color: Luma<S, U>) -> Self where
U: Component,
T: FromComponent<U>,
Convert from another component type.
sourcepub fn into_components(self) -> (T,)
pub fn into_components(self) -> (T,)
Convert to a (luma,)
tuple.
sourcepub fn from_components((luma): (T,)) -> Self
pub fn from_components((luma): (T,)) -> Self
Convert from a (luma,)
tuple.
sourceimpl<S, T> Luma<S, T> where
T: FloatComponent,
S: LumaStandard,
impl<S, T> Luma<S, T> where
T: FloatComponent,
S: LumaStandard,
sourcepub fn into_linear(self) -> Luma<Linear<S::WhitePoint>, T>
pub fn into_linear(self) -> Luma<Linear<S::WhitePoint>, T>
Convert the color to linear luminance.
sourcepub fn from_linear(color: Luma<Linear<S::WhitePoint>, T>) -> Luma<S, T>
pub fn from_linear(color: Luma<Linear<S::WhitePoint>, T>) -> Luma<S, T>
Convert linear luminance to non-linear luminance.
sourcepub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
self
) -> Luma<St, T>
pub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
self
) -> Luma<St, T>
Convert the color to a different encoding.
sourcepub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
color: Luma<St, T>
) -> Luma<S, T>
pub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
color: Luma<St, T>
) -> Luma<S, T>
Convert luminance from a different encoding.
Trait Implementations
sourceimpl<S, T> AbsDiffEq<Luma<S, T>> for Luma<S, T> where
T: Component + AbsDiffEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
impl<S, T> AbsDiffEq<Luma<S, T>> for Luma<S, T> where
T: Component + AbsDiffEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl<S, T> Add<Luma<S, T>> for Luma<S, T> where
T: Component + Add,
S: LumaStandard<TransferFn = LinearFn>,
<T as Add>::Output: Component,
impl<S, T> Add<Luma<S, T>> for Luma<S, T> where
T: Component + Add,
S: LumaStandard<TransferFn = LinearFn>,
<T as Add>::Output: Component,
sourceimpl<S, T> Add<T> for Luma<S, T> where
T: Component + Add,
S: LumaStandard<TransferFn = LinearFn>,
<T as Add>::Output: Component,
impl<S, T> Add<T> for Luma<S, T> where
T: Component + Add,
S: LumaStandard<TransferFn = LinearFn>,
<T as Add>::Output: Component,
sourceimpl<S, T> AddAssign<Luma<S, T>> for Luma<S, T> where
T: Component + AddAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> AddAssign<Luma<S, T>> for Luma<S, T> where
T: Component + AddAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn add_assign(&mut self, other: Luma<S, T>)
fn add_assign(&mut self, other: Luma<S, T>)
Performs the +=
operation. Read more
sourceimpl<S, T> AddAssign<T> for Luma<S, T> where
T: Component + AddAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> AddAssign<T> for Luma<S, T> where
T: Component + AddAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
Performs the +=
operation. Read more
sourceimpl<S, T, P> AsMut<P> for Luma<S, T> where
T: Component,
S: LumaStandard,
P: RawPixel<T> + ?Sized,
impl<S, T, P> AsMut<P> for Luma<S, T> where
T: Component,
S: LumaStandard,
P: RawPixel<T> + ?Sized,
sourceimpl<S, T, P> AsRef<P> for Luma<S, T> where
T: Component,
S: LumaStandard,
P: RawPixel<T> + ?Sized,
impl<S, T, P> AsRef<P> for Luma<S, T> where
T: Component,
S: LumaStandard,
P: RawPixel<T> + ?Sized,
sourceimpl<S, T> Blend for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> Blend for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn into_premultiplied(self) -> PreAlpha<Luma<S, T>, T>
fn into_premultiplied(self) -> PreAlpha<Luma<S, T>, T>
Convert the color to premultiplied alpha.
sourcefn from_premultiplied(color: PreAlpha<Luma<S, T>, T>) -> Self
fn from_premultiplied(color: PreAlpha<Luma<S, T>, T>) -> Self
Convert the color from premultiplied alpha.
sourcefn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
fn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
Blend self, as the source color, with destination
, using
blend_function
. Anything that implements BlendFunction
is
acceptable, including functions and closures. Read more
sourcefn over(self, other: Self) -> Self
fn over(self, other: Self) -> Self
Place self
over other
. This is the good old common alpha
composition equation. Read more
sourcefn inside(self, other: Self) -> Self
fn inside(self, other: Self) -> Self
Results in the parts of self
that overlaps the visible parts of
other
. Read more
sourcefn outside(self, other: Self) -> Self
fn outside(self, other: Self) -> Self
Results in the parts of self
that lies outside the visible parts of
other
. Read more
sourcefn plus(self, other: Self) -> Self
fn plus(self, other: Self) -> Self
Add self
and other
. This uses the alpha component to regulate the
effect, so it’s not just plain component wise addition. Read more
sourcefn multiply(self, other: Self) -> Self
fn multiply(self, other: Self) -> Self
Multiply self
with other
. This uses the alpha component to regulate
the effect, so it’s not just plain component wise multiplication. Read more
sourcefn overlay(self, other: Self) -> Self
fn overlay(self, other: Self) -> Self
Multiply self
or other
if other is dark, or screen them if other
is light. This results in an S curve. Read more
sourcefn dodge(self, other: Self) -> Self
fn dodge(self, other: Self) -> Self
Lighten other
to reflect self
. Results in other
if self
is
black. Read more
sourcefn burn(self, other: Self) -> Self
fn burn(self, other: Self) -> Self
Darken other
to reflect self
. Results in other
if self
is
white. Read more
sourcefn hard_light(self, other: Self) -> Self
fn hard_light(self, other: Self) -> Self
Multiply self
or other
if other is dark, or screen them if self
is light. This is similar to overlay
, but depends on self
instead
of other
. Read more
sourcefn soft_light(self, other: Self) -> Self
fn soft_light(self, other: Self) -> Self
Lighten other
if self
is light, or darken other
as if it’s burned
if self
is dark. The effect is increased if the components of self
is further from 0.5. Read more
sourcefn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Return the absolute difference between self
and other
. It’s
basically abs(self - other)
, but regulated by the alpha component. Read more
sourceimpl<S, T> Clamp for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Clamp for Luma<S, T> where
T: Component,
S: LumaStandard,
sourcefn is_within_bounds(&self) -> bool
fn is_within_bounds(&self) -> bool
Check if the color’s components are within the expected clamped range bounds. Read more
sourcefn clamp(&self) -> Luma<S, T>
fn clamp(&self) -> Luma<S, T>
Return a new color where the components have been clamped to the nearest valid values. Read more
sourcefn clamp_self(&mut self)
fn clamp_self(&mut self)
Clamp the color’s components to the nearest valid values.
sourceimpl<S, T> Clone for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Clone for Luma<S, T> where
T: Component,
S: LumaStandard,
sourceimpl<S, T> ComponentWise for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> ComponentWise for Luma<S, T> where
T: Component,
S: LumaStandard,
type Scalar = T
type Scalar = T
The scalar type for color components.
sourcefn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Luma<S, T>,
f: F
) -> Luma<S, T>
fn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Luma<S, T>,
f: F
) -> Luma<S, T>
Perform a binary operation on this and an other color.
sourcefn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Luma<S, T>
fn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Luma<S, T>
Perform a unary operation on this color.
sourceimpl<S, T> Default for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Default for Luma<S, T> where
T: Component,
S: LumaStandard,
sourceimpl<S, T> Div<Luma<S, T>> for Luma<S, T> where
T: Component + Div,
S: LumaStandard<TransferFn = LinearFn>,
<T as Div>::Output: Component,
impl<S, T> Div<Luma<S, T>> for Luma<S, T> where
T: Component + Div,
S: LumaStandard<TransferFn = LinearFn>,
<T as Div>::Output: Component,
sourceimpl<S, T> Div<T> for Luma<S, T> where
T: Component + Div,
S: LumaStandard<TransferFn = LinearFn>,
<T as Div>::Output: Component,
impl<S, T> Div<T> for Luma<S, T> where
T: Component + Div,
S: LumaStandard<TransferFn = LinearFn>,
<T as Div>::Output: Component,
sourceimpl<S, T> DivAssign<Luma<S, T>> for Luma<S, T> where
T: Component + DivAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> DivAssign<Luma<S, T>> for Luma<S, T> where
T: Component + DivAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn div_assign(&mut self, other: Luma<S, T>)
fn div_assign(&mut self, other: Luma<S, T>)
Performs the /=
operation. Read more
sourceimpl<S, T> DivAssign<T> for Luma<S, T> where
T: Component + DivAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> DivAssign<T> for Luma<S, T> where
T: Component + DivAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn div_assign(&mut self, c: T)
fn div_assign(&mut self, c: T)
Performs the /=
operation. Read more
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsluv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Hsluv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Hsluv<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Hsluv<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Hsv<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Hsv<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
sourcefn from_color_unclamped(color: Hsv<_S, T>) -> Self
fn from_color_unclamped(color: Hsv<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Hwb<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Hwb<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
sourcefn from_color_unclamped(color: Hwb<_S, T>) -> Self
fn from_color_unclamped(color: Hwb<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lab<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lab<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Lab<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Lab<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lch<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lch<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Lch<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Lch<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lchuv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lchuv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Lchuv<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Lchuv<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, S> FromColorUnclamped<Luma<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, S> FromColorUnclamped<Luma<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<S, T>) -> Self
fn from_color_unclamped(color: Luma<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, S> FromColorUnclamped<Luma<S, T>> for Yxy<S::WhitePoint, T> where
T: FloatComponent,
S: LumaStandard,
impl<T, S> FromColorUnclamped<Luma<S, T>> for Yxy<S::WhitePoint, T> where
T: FloatComponent,
S: LumaStandard,
sourcefn from_color_unclamped(luma: Luma<S, T>) -> Self
fn from_color_unclamped(luma: Luma<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S1, S2, T> FromColorUnclamped<Luma<S2, T>> for Luma<S1, T> where
S1: LumaStandard,
S2: LumaStandard<WhitePoint = S1::WhitePoint>,
T: FloatComponent,
impl<S1, S2, T> FromColorUnclamped<Luma<S2, T>> for Luma<S1, T> where
S1: LumaStandard,
S2: LumaStandard<WhitePoint = S1::WhitePoint>,
T: FloatComponent,
sourcefn from_color_unclamped(color: Luma<S2, T>) -> Self
fn from_color_unclamped(color: Luma<S2, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, St, T> FromColorUnclamped<Luma<St, T>> for Rgb<S, T> where
S: RgbStandard,
St: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
T: FloatComponent,
impl<S, St, T> FromColorUnclamped<Luma<St, T>> for Rgb<S, T> where
S: RgbStandard,
St: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
T: FloatComponent,
sourcefn from_color_unclamped(color: Luma<St, T>) -> Self
fn from_color_unclamped(color: Luma<St, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Luma<_S, T>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _S> FromColorUnclamped<Luma<_S, T>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = D65>,
impl<T, _S> FromColorUnclamped<Luma<_S, T>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = D65>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _S> FromColorUnclamped<Luma<_S, T>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = D65>,
impl<T, _S> FromColorUnclamped<Luma<_S, T>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = D65>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Luv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Luv<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Luv<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Luv<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Oklab<T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
Xyz<S::WhitePoint, T>: FromColorUnclamped<Oklab<T>>,
impl<S, T> FromColorUnclamped<Oklab<T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
Xyz<S::WhitePoint, T>: FromColorUnclamped<Oklab<T>>,
sourcefn from_color_unclamped(color: Oklab<T>) -> Self
fn from_color_unclamped(color: Oklab<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Oklch<T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
Xyz<S::WhitePoint, T>: FromColorUnclamped<Oklch<T>>,
impl<S, T> FromColorUnclamped<Oklch<T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
Xyz<S::WhitePoint, T>: FromColorUnclamped<Oklch<T>>,
sourcefn from_color_unclamped(color: Oklch<T>) -> Self
fn from_color_unclamped(color: Oklch<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Rgb<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Rgb<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
sourcefn from_color_unclamped(color: Rgb<_S, T>) -> Self
fn from_color_unclamped(color: Rgb<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Xyz<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
sourcefn from_color_unclamped(color: Yxy<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Yxy<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> Mix for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> Mix for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
sourceimpl<S, T> Mul<Luma<S, T>> for Luma<S, T> where
T: Component + Mul,
S: LumaStandard<TransferFn = LinearFn>,
<T as Mul>::Output: Component,
impl<S, T> Mul<Luma<S, T>> for Luma<S, T> where
T: Component + Mul,
S: LumaStandard<TransferFn = LinearFn>,
<T as Mul>::Output: Component,
sourceimpl<S, T> Mul<T> for Luma<S, T> where
T: Component + Mul,
S: LumaStandard<TransferFn = LinearFn>,
<T as Mul>::Output: Component,
impl<S, T> Mul<T> for Luma<S, T> where
T: Component + Mul,
S: LumaStandard<TransferFn = LinearFn>,
<T as Mul>::Output: Component,
sourceimpl<S, T> MulAssign<Luma<S, T>> for Luma<S, T> where
T: Component + MulAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> MulAssign<Luma<S, T>> for Luma<S, T> where
T: Component + MulAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn mul_assign(&mut self, other: Luma<S, T>)
fn mul_assign(&mut self, other: Luma<S, T>)
Performs the *=
operation. Read more
sourceimpl<S, T> MulAssign<T> for Luma<S, T> where
T: Component + MulAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> MulAssign<T> for Luma<S, T> where
T: Component + MulAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn mul_assign(&mut self, c: T)
fn mul_assign(&mut self, c: T)
Performs the *=
operation. Read more
sourceimpl<S, T> PartialEq<Luma<S, T>> for Luma<S, T> where
T: Component + PartialEq,
S: LumaStandard,
impl<S, T> PartialEq<Luma<S, T>> for Luma<S, T> where
T: Component + PartialEq,
S: LumaStandard,
sourceimpl<S, T> Pixel<T> for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Pixel<T> for Luma<S, T> where
T: Component,
S: LumaStandard,
sourcefn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
Cast as a mutable reference to raw color components.
sourcefn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
Convert into raw color components.
sourcefn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
Cast from a reference to raw color components.
sourcefn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
Cast from a mutable reference to raw color components.
sourcefn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a slice of raw color components to a slice of colors. Read more
sourcefn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
sourceimpl<S, T> RelativeContrast for Luma<S, T> where
T: FloatComponent,
S: LumaStandard,
impl<S, T> RelativeContrast for Luma<S, T> where
T: FloatComponent,
S: LumaStandard,
type Scalar = T
type Scalar = T
The type of the contrast ratio.
sourcefn get_contrast_ratio(&self, other: &Self) -> T
fn get_contrast_ratio(&self, other: &Self) -> T
Calculate the contrast ratio between two colors.
sourcefn has_min_contrast_text(&self, other: &Self) -> bool
fn has_min_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3. Contrast is at least 4.5:1 (Level AA). Read more
sourcefn has_min_contrast_large_text(&self, other: &Self) -> bool
fn has_min_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3 for large text. Contrast is at least 3:1 (Level AA). Read more
sourcefn has_enhanced_contrast_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6. Contrast is at least 7:1 (Level AAA). Read more
sourcefn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6 for large text. Contrast is at least 4.5:1 (Level AAA). Read more
sourcefn has_min_contrast_graphics(&self, other: &Self) -> bool
fn has_min_contrast_graphics(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.11 for graphical objects. Contrast is at least 3:1 (Level AA). Read more
sourceimpl<S, T> RelativeEq<Luma<S, T>> for Luma<S, T> where
T: Component + RelativeEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
impl<S, T> RelativeEq<Luma<S, T>> for Luma<S, T> where
T: Component + RelativeEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
sourcefn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
sourcefn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of RelativeEq::relative_eq
.
sourceimpl<S, T> Shade for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> Shade for Luma<S, T> where
T: FloatComponent,
S: LumaStandard<TransferFn = LinearFn>,
type Scalar = T
type Scalar = T
The type of the lighten/darken modifier.
sourcefn lighten(&self, factor: T) -> Luma<S, T>
fn lighten(&self, factor: T) -> Luma<S, T>
Scale the color towards the maximum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn lighten_fixed(&self, amount: T) -> Luma<S, T>
fn lighten_fixed(&self, amount: T) -> Luma<S, T>
Lighten the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourcefn darken(&self, factor: Self::Scalar) -> Self
fn darken(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn darken_fixed(&self, amount: Self::Scalar) -> Self
fn darken_fixed(&self, amount: Self::Scalar) -> Self
Darken the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourceimpl<S, T> Sub<Luma<S, T>> for Luma<S, T> where
T: Component + Sub,
S: LumaStandard<TransferFn = LinearFn>,
<T as Sub>::Output: Component,
impl<S, T> Sub<Luma<S, T>> for Luma<S, T> where
T: Component + Sub,
S: LumaStandard<TransferFn = LinearFn>,
<T as Sub>::Output: Component,
sourceimpl<S, T> Sub<T> for Luma<S, T> where
T: Component + Sub,
S: LumaStandard<TransferFn = LinearFn>,
<T as Sub>::Output: Component,
impl<S, T> Sub<T> for Luma<S, T> where
T: Component + Sub,
S: LumaStandard<TransferFn = LinearFn>,
<T as Sub>::Output: Component,
sourceimpl<S, T> SubAssign<Luma<S, T>> for Luma<S, T> where
T: Component + SubAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> SubAssign<Luma<S, T>> for Luma<S, T> where
T: Component + SubAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn sub_assign(&mut self, other: Luma<S, T>)
fn sub_assign(&mut self, other: Luma<S, T>)
Performs the -=
operation. Read more
sourceimpl<S, T> SubAssign<T> for Luma<S, T> where
T: Component + SubAssign,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> SubAssign<T> for Luma<S, T> where
T: Component + SubAssign,
S: LumaStandard<TransferFn = LinearFn>,
sourcefn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
Performs the -=
operation. Read more
sourceimpl<S, T> UlpsEq<Luma<S, T>> for Luma<S, T> where
T: Component + UlpsEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
impl<S, T> UlpsEq<Luma<S, T>> for Luma<S, T> where
T: Component + UlpsEq,
T::Epsilon: Copy,
S: LumaStandard + PartialEq,
sourceimpl<S, T, _A> WithAlpha<_A> for Luma<S, T> where
T: Component,
S: LumaStandard,
_A: Component,
impl<S, T, _A> WithAlpha<_A> for Luma<S, T> where
T: Component,
S: LumaStandard,
_A: Component,
sourcefn with_alpha(self, alpha: _A) -> Self::WithAlpha
fn with_alpha(self, alpha: _A) -> Self::WithAlpha
Transforms the color into a transparent color with the provided
alpha value. If Self
already has a transparency, it is
overwritten. Read more
sourcefn without_alpha(self) -> Self::Color
fn without_alpha(self) -> Self::Color
Removes the transparency from the color. If Self::Color
has
an internal transparency field, that field will be set to
A::max_intensity()
to make it opaque. Read more
sourcefn split(self) -> (Self::Color, _A)
fn split(self) -> (Self::Color, _A)
Splits the color into separate color and transparency values. Read more
sourcefn opaque(self) -> Self::WithAlpha
fn opaque(self) -> Self::WithAlpha
Transforms the color into a fully opaque color with a transparency
field. If Self
already has a transparency, it is overwritten. Read more
sourcefn transparent(self) -> Self::WithAlpha
fn transparent(self) -> Self::WithAlpha
Transforms the color into a fully transparent color. If Self
already has a transparency, it is overwritten. Read more
impl<S, T> Copy for Luma<S, T> where
T: Component,
S: LumaStandard,
impl<S, T> Eq for Luma<S, T> where
T: Component + Eq,
S: LumaStandard,
Auto Trait Implementations
impl<S, T> RefUnwindSafe for Luma<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for Luma<S, T> where
S: Send,
T: Send,
impl<S, T> Sync for Luma<S, T> where
S: Sync,
T: Sync,
impl<S, T> Unpin for Luma<S, T> where
S: Unpin,
T: Unpin,
impl<S, T> UnwindSafe for Luma<S, T> where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
sourcefn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_from(color: S) -> Self
fn adapt_from(color: S) -> Self
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn from_color(t: T) -> U
fn from_color(t: T) -> U
Convert from T with values clamped to the color defined bounds. Read more
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourceimpl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
fn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
Convert from T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more