[−][src]Enum amethyst_rendy::palette::Color
A generic color type.
The Color
may belong to any color space and it may change
depending on which operation is performed. That makes it immune to
the "without conversion" rule of the operations it supports. The
color spaces are selected as follows:
Mix
: RGB for no particular reason, except that it's intuitive.Shade
: CIE L*a*b* for its luminance component.Hue
andGetHue
: CIE L*C*h° for its hue component and how it preserves the apparent lightness.Saturate
: CIE L*C*h° for its chromaticity component and how it preserves the apparent lightness.
It's not recommended to use Color
when full control is necessary,
but it can easily be converted to a fixed color space in those
cases.
Variants
Luma(Luma<Linear<<S as RgbSpace>::WhitePoint>, T>)
Linear luminance.
Rgb(Rgb<Linear<S>, T>)
Linear RGB.
Xyz(Xyz<<S as RgbSpace>::WhitePoint, T>)
CIE 1931 XYZ.
Yxy(Yxy<<S as RgbSpace>::WhitePoint, T>)
CIE 1931 Yxy.
Lab(Lab<<S as RgbSpace>::WhitePoint, T>)
CIE L*a*b* (CIELAB).
Lch(Lch<<S as RgbSpace>::WhitePoint, T>)
CIE L*C*h°, a polar version of CIE L*a*b*.
Hsv(Hsv<S, T>)
Linear HSV, a cylindrical version of RGB.
Hsl(Hsl<S, T>)
Linear HSL, a cylindrical version of RGB.
Hwb(Hwb<S, T>)
Linear HWB, an intuitive cylindrical version of RGB.
Methods
impl<T> Color<Srgb, T> where
T: Component + Float,
[src]
T: Component + Float,
pub fn linear_y(luma: T) -> Color<Srgb, T>
[src]
Linear luminance.
pub fn linear_rgb(red: T, green: T, blue: T) -> Color<Srgb, T>
[src]
Linear RGB.
pub fn xyz(x: T, y: T, z: T) -> Color<Srgb, T>
[src]
CIE XYZ.
pub fn yxy(x: T, y: T, luma: T) -> Color<Srgb, T>
[src]
CIE Yxy.
pub fn lab(l: T, a: T, b: T) -> Color<Srgb, T>
[src]
CIE L*a*b*.
pub fn lch(l: T, chroma: T, hue: LabHue<T>) -> Color<Srgb, T>
[src]
CIE L*C*h°.
pub fn hsv(hue: RgbHue<T>, saturation: T, value: T) -> Color<Srgb, T>
[src]
Linear HSV.
pub fn hsl(hue: RgbHue<T>, saturation: T, lightness: T) -> Color<Srgb, T>
[src]
Linear HSL.
pub fn hwb(hue: RgbHue<T>, whiteness: T, balckness: T) -> Color<Srgb, T>
[src]
Linear HWB.
Trait Implementations
impl<S, T> Default for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> Copy for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> Clone for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
fn clone(&self) -> Color<S, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S, T> Blend for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
type Color = Rgb<Linear<S>, T>
The core color type. Typically Self
for color types without alpha.
fn into_premultiplied(self) -> PreAlpha<Rgb<Linear<S>, T>, T>
[src]
fn from_premultiplied(color: PreAlpha<Rgb<Linear<S>, T>, T>) -> Color<S, T>
[src]
fn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
[src]
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
fn over(self, other: Self) -> Self
[src]
Place self
over other
. This is the good old common alpha composition equation. Read more
fn inside(self, other: Self) -> Self
[src]
Results in the parts of self
that overlaps the visible parts of other
. Read more
fn outside(self, other: Self) -> Self
[src]
Results in the parts of self
that lies outside the visible parts of other
. Read more
fn atop(self, other: Self) -> Self
[src]
Place self
over only the visible parts of other
.
fn xor(self, other: Self) -> Self
[src]
Results in either self
or other
, where they do not overlap.
fn plus(self, other: Self) -> Self
[src]
Add self
and other
. This uses the alpha component to regulate the effect, so it's not just plain component wise addition. Read more
fn multiply(self, other: Self) -> Self
[src]
Multiply self
with other
. This uses the alpha component to regulate the effect, so it's not just plain component wise multiplication. Read more
fn screen(self, other: Self) -> Self
[src]
Make a color which is at least as light as self
or other
.
fn overlay(self, other: Self) -> Self
[src]
Multiply self
or other
if other is dark, or screen them if other
is light. This results in an S curve. Read more
fn darken(self, other: Self) -> Self
[src]
Return the darkest parts of self
and other
.
fn lighten(self, other: Self) -> Self
[src]
Return the lightest parts of self
and other
.
fn dodge(self, other: Self) -> Self
[src]
Lighten other
to reflect self
. Results in other
if self
is black. Read more
fn burn(self, other: Self) -> Self
[src]
Darken other
to reflect self
. Results in other
if self
is white. Read more
fn hard_light(self, other: Self) -> Self
[src]
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
fn soft_light(self, other: Self) -> Self
[src]
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
fn difference(self, other: Self) -> Self
[src]
Return the absolute difference between self
and other
. It's basically abs(self - other)
, but regulated by the alpha component. Read more
fn exclusion(self, other: Self) -> Self
[src]
Similar to difference
, but appears to result in a lower contrast. other
is inverted if self
is white, and preserved if self
is black. Read more
impl<S, T> Saturate for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
type Scalar = T
The type of the (de)saturation factor.
fn saturate(&self, factor: T) -> Color<S, T>
[src]
fn desaturate(&self, factor: Self::Scalar) -> Self
[src]
Decrease the saturation by factor
.
impl<S, T> Mix for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
type Scalar = T
The type of the mixing factor.
fn mix(&self, other: &Color<S, T>, factor: T) -> Color<S, T>
[src]
impl<S, T> ApproxEq for Color<S, T> where
S: RgbSpace,
T: Float + Component + ApproxEq,
<T as ApproxEq>::Epsilon: Float,
[src]
S: RgbSpace,
T: Float + Component + ApproxEq,
<T as ApproxEq>::Epsilon: Float,
type Epsilon = <T as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <Color<S, T> as ApproxEq>::Epsilon
[src]
fn default_max_relative() -> <Color<S, T> as ApproxEq>::Epsilon
[src]
fn default_max_ulps() -> u32
[src]
fn relative_eq(
&self,
other: &Color<S, T>,
epsilon: <Color<S, T> as ApproxEq>::Epsilon,
max_relative: <Color<S, T> as ApproxEq>::Epsilon
) -> bool
[src]
&self,
other: &Color<S, T>,
epsilon: <Color<S, T> as ApproxEq>::Epsilon,
max_relative: <Color<S, T> as ApproxEq>::Epsilon
) -> bool
fn ulps_eq(
&self,
other: &Color<S, T>,
epsilon: <Color<S, T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
&self,
other: &Color<S, T>,
epsilon: <Color<S, T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of ApproxEq::relative_eq
.
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
The inverse of ApproxEq::ulps_eq
.
impl<S, T> Debug for Color<S, T> where
S: Debug + RgbSpace,
T: Debug + Float + Component,
<S as RgbSpace>::WhitePoint: Debug,
[src]
S: Debug + RgbSpace,
T: Debug + Float + Component,
<S as RgbSpace>::WhitePoint: Debug,
impl<S, T> From<Alpha<Xyz<<S as RgbSpace>::WhitePoint, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Hsl<S, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<<S as RgbStandard>::Space, T>> for Alpha<Rgb<S, T>, T> where
S: RgbStandard,
T: Component + Float,
[src]
S: RgbStandard,
T: Component + Float,
impl<Wp, T, _S> From<Color<_S, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T> From<Color<S, T>> for Alpha<Hwb<S, T>, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<Wp, T, _S> From<Color<_S, T>> for Alpha<Lch<Wp, T>, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T, _S> From<Color<_S, T>> for Alpha<Luma<S, T>, T> where
S: LumaStandard,
T: Component + Float,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
[src]
S: LumaStandard,
T: Component + Float,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<Wp, T, _S> From<Color<_S, T>> for Lab<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T> From<Alpha<Lch<<S as RgbSpace>::WhitePoint, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Lab<<S as RgbSpace>::WhitePoint, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Lch<<S as RgbSpace>::WhitePoint, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Luma<Linear<<S as RgbSpace>::WhitePoint>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Alpha<Lab<<S as RgbSpace>::WhitePoint, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<S, T>> for Hsv<S, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<Wp, T, _S> From<Color<_S, T>> for Lch<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T> From<Alpha<Yxy<<S as RgbSpace>::WhitePoint, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Alpha<Hsl<S, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<Wp, T, _S> From<Color<_S, T>> for Alpha<Xyz<Wp, T>, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T, _S> From<Color<_S, T>> for Luma<S, T> where
S: LumaStandard,
T: Component + Float,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
[src]
S: LumaStandard,
T: Component + Float,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<Wp, T, _S> From<Color<_S, T>> for Alpha<Yxy<Wp, T>, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T> From<Alpha<Hwb<S, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<<S as RgbStandard>::Space, T>> for Rgb<S, T> where
S: RgbStandard,
T: Component + Float,
[src]
S: RgbStandard,
T: Component + Float,
impl<S, T> From<Color<S, T>> for Alpha<Hsv<S, T>, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<Wp, T, _S> From<Color<_S, T>> for Alpha<Lab<Wp, T>, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Color<_S, T>> for Yxy<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
[src]
T: Component + Float,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<S, T> From<Hsv<S, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<S, T>> for Alpha<Hsl<S, T>, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<S, T> From<Alpha<Rgb<Linear<S>, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<S, T>> for Hwb<S, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<S, T> From<Hwb<S, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Alpha<Hsv<S, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Alpha<Luma<Linear<<S as RgbSpace>::WhitePoint>, T>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Color<S, T>> for Hsl<S, T> where
S: RgbSpace,
T: Component + Float,
[src]
S: RgbSpace,
T: Component + Float,
impl<S, T> From<Yxy<<S as RgbSpace>::WhitePoint, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Xyz<<S as RgbSpace>::WhitePoint, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> From<Rgb<Linear<S>, T>> for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
impl<S, T> Shade for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
type Scalar = T
The type of the lighten/darken amount.
fn lighten(&self, amount: T) -> Color<S, T>
[src]
fn darken(&self, amount: Self::Scalar) -> Self
[src]
Darken the color by amount
.
impl<S, T> GetHue for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
type Hue = LabHue<T>
The kind of hue unit this color space uses. Read more
fn get_hue(&self) -> Option<LabHue<T>>
[src]
impl<S, T> Hue for Color<S, T> where
S: RgbSpace,
T: Float + Component,
[src]
S: RgbSpace,
T: Float + Component,
Auto Trait Implementations
impl<S, T> Unpin for Color<S, T> where
S: Unpin,
T: Unpin,
<S as RgbSpace>::WhitePoint: Unpin,
S: Unpin,
T: Unpin,
<S as RgbSpace>::WhitePoint: Unpin,
impl<S, T> Sync for Color<S, T> where
S: Sync,
T: Sync,
<S as RgbSpace>::WhitePoint: Sync,
S: Sync,
T: Sync,
<S as RgbSpace>::WhitePoint: Sync,
impl<S, T> Send for Color<S, T> where
S: Send,
T: Send,
<S as RgbSpace>::WhitePoint: Send,
S: Send,
T: Send,
<S as RgbSpace>::WhitePoint: Send,
impl<S, T> UnwindSafe for Color<S, T> where
S: UnwindSafe,
T: UnwindSafe,
<S as RgbSpace>::WhitePoint: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
<S as RgbSpace>::WhitePoint: UnwindSafe,
impl<S, T> RefUnwindSafe for Color<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
<S as RgbSpace>::WhitePoint: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
<S as RgbSpace>::WhitePoint: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
Convert the source color to the destination color using the bradford method by default Read more
impl<T> SetParameter for T
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Supports<T> for T
[src]
impl<T> Erased for T
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> Clone for T where
T: Clone,
[src]
T: Clone,