Skip to main content

Lms

Struct Lms 

Source
#[repr(C)]
pub struct Lms<M, T> { pub long: T, pub medium: T, pub short: T, pub meta: PhantomData<M>, }
Expand description

Generic LMS.

LMS represents the response of the eye’s cone cells. L, M and S are for “long”, “medium” and “short” wavelengths, roughly corresponding to red, green and blue. Many newer mentions of an LMS representation use the letters R, G and B instead (or sometimes ρ, γ, β), but this library sticks to LMS to differentiate it from Rgb.

The LMS color space is a model of the physiological response to color stimuli. It has some mathematical shortcomings that Xyz improves on, such as severe spectral sensitivity overlap between L, M and S. Despite this, LMS has a lot of uses, include chromatic adaptation and emulating different types of color vision deficiency, and it’s sometimes part of the conversion process between other color spaces.

§Creating a Value

An LMS value is often derived from another color space, through a conversion matrix. Two such matrices are VonKries and Bradford, and Palette offers type aliases in the lms module to make using them a bit more convenient. It’s of course also possible to simply use Lms::new, but it may not be as intuitive.

use palette::{
    lms::{Lms, VonKriesLms, matrix::VonKries},
    white_point::D65,
    Srgb, FromColor
};

let von_kries_lms = Lms::<VonKries, f32>::new(0.1, 0.2, 0.3);
let von_kries_d65_lms = VonKriesLms::<D65, f32>::new(0.1, 0.2, 0.3);

// `new` is also `const`:
const VON_KRIES_LMS: Lms<VonKries, f32> = Lms::new(0.1, 0.2, 0.3);

// Von Kries LMS from sRGB:
let lms_from_srgb = VonKriesLms::<D65, f32>::from_color(Srgb::new(0.3f32, 0.8, 0.1));

// It's also possible to convert from (and to) arrays and tuples:
let lms_from_array = VonKriesLms::<D65, f32>::from([0.1, 0.2, 0.3]);
let lms_from_tuple = VonKriesLms::<D65, f32>::from((0.1, 0.2, 0.3));

Fields§

§long: T

Stimulus from long wavelengths, or red, or ρ. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§medium: T

Stimulus from medium wavelengths, or green, or γ. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§short: T

Stimulus from short wavelengths, or blue, or β. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§meta: PhantomData<M>

Type level meta information, such as reference white, or which matrix was used when converting from XYZ.

Implementations§

Source§

impl<M, T> Lms<M, T>

Source

pub const fn new(long: T, medium: T, short: T) -> Lms<M, T>

Create a new LMS color.

Source

pub fn into_format<U>(self) -> Lms<M, U>
where U: FromStimulus<T>,

Convert the LMS components into another number type.

use palette::{
    lms::VonKriesLms,
    white_point::D65,
};

let lms_f64: VonKriesLms<D65, f64> = VonKriesLms::new(0.3f32, 0.7, 0.2).into_format();
Source

pub fn from_format<U>(color: Lms<M, U>) -> Lms<M, T>
where T: FromStimulus<U>,

Convert the LMS components from another number type.

use palette::{
    lms::VonKriesLms,
    white_point::D65,
};

let lms_f64 = VonKriesLms::<D65, f64>::from_format(VonKriesLms::new(0.3f32, 0.7, 0.2));
Source

pub fn into_components(self) -> (T, T, T)

Convert to a (long, medium, short) tuple.

Source

pub fn from_components(_: (T, T, T)) -> Lms<M, T>

Convert from a (long, medium, short) tuple.

Source

pub fn with_meta<NewM>(self) -> Lms<NewM, T>

Changes the meta type without changing the color value.

This function doesn’t change the numerical values, and thus the stimuli it represents in an absolute sense. However, the appearance of the color may not be the same. The effect may be similar to taking a photo with an incorrect white balance.

Source§

impl<M, T> Lms<M, T>
where T: Zero,

Source

pub fn min_short() -> T

Return the short value minimum.

Source

pub fn min_medium() -> T

Return the medium value minimum.

Source

pub fn min_long() -> T

Return the long value minimum.

Source§

impl<M, T> Lms<M, T>

Source

pub fn matrix_from_xyz() -> Matrix3<Xyz<<M as HasXyzMeta>::XyzMeta, T>, Lms<M, T>>

Produce a conversion matrix from Xyz to Lms.

Source§

impl<M, T> Lms<M, &T>

Source

pub fn copied(&self) -> Lms<M, T>
where T: Copy,

Get an owned, copied version of this color.

Source

pub fn cloned(&self) -> Lms<M, T>
where T: Clone,

Get an owned, cloned version of this color.

Source§

impl<M, T> Lms<M, &mut T>

Source

pub fn set(&mut self, value: Lms<M, T>)

Update this color with new values.

Source

pub fn as_refs(&self) -> Lms<M, &T>

Borrow this color’s components as shared references.

Source

pub fn copied(&self) -> Lms<M, T>
where T: Copy,

Get an owned, copied version of this color.

Source

pub fn cloned(&self) -> Lms<M, T>
where T: Clone,

Get an owned, cloned version of this color.

Source§

impl<M, C> Lms<M, C>

Source

pub fn iter<'a>(&'a self) -> <&'a Lms<M, C> as IntoIterator>::IntoIter
where &'a Lms<M, C>: IntoIterator,

Return an iterator over the colors in the wrapped collections.

Source

pub fn iter_mut<'a>( &'a mut self, ) -> <&'a mut Lms<M, C> as IntoIterator>::IntoIter
where &'a mut Lms<M, C>: IntoIterator,

Return an iterator that allows modifying the colors in the wrapped collections.

Source

pub fn get<'a, I, T>( &'a self, index: I, ) -> Option<Lms<M, &'a <I as SliceIndex<[T]>>::Output>>
where T: 'a, C: AsRef<[T]>, I: SliceIndex<[T]> + Clone,

Get a color, or slice of colors, with references to the components at index. See slice::get for details.

Source

pub fn get_mut<'a, I, T>( &'a mut self, index: I, ) -> Option<Lms<M, &'a mut <I as SliceIndex<[T]>>::Output>>
where T: 'a, C: AsMut<[T]>, I: SliceIndex<[T]> + Clone,

Get a color, or slice of colors, that allows modifying the components at index. See slice::get_mut for details.

Source§

impl<M, T> Lms<M, Vec<T>>

Source

pub fn with_capacity(capacity: usize) -> Lms<M, Vec<T>>

Available on crate feature alloc only.

Create a struct of vectors with a minimum capacity. See Vec::with_capacity for details.

Source

pub fn push(&mut self, value: Lms<M, T>)

Available on crate feature alloc only.

Push an additional color’s components onto the component vectors. See Vec::push for details.

Source

pub fn pop(&mut self) -> Option<Lms<M, T>>

Available on crate feature alloc only.

Pop a color’s components from the component vectors. See Vec::pop for details.

Source

pub fn clear(&mut self)

Available on crate feature alloc only.

Clear the component vectors. See Vec::clear for details.

Source

pub fn drain<R>(&mut self, range: R) -> Iter<Drain<'_, T>, M>
where R: RangeBounds<usize> + Clone,

Available on crate feature alloc only.

Return an iterator that moves colors out of the specified range.

Trait Implementations§

Source§

impl<M, T> AbsDiffEq for Lms<M, T>
where T: AbsDiffEq, <T as AbsDiffEq>::Epsilon: Clone,

Available on crate feature approx only.
Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> <Lms<M, T> as AbsDiffEq>::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, ) -> bool

The inverse of [AbsDiffEq::abs_diff_eq].
Source§

impl<M, T> Add<T> for Lms<M, T>
where T: Add<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the + operator.
Source§

fn add(self, c: T) -> <Lms<M, T> as Add<T>>::Output

Performs the + operation. Read more
Source§

impl<M, T> Add for Lms<M, T>
where T: Add<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Lms<M, T>) -> <Lms<M, T> as Add>::Output

Performs the + operation. Read more
Source§

impl<M, T> AddAssign<T> for Lms<M, T>
where T: AddAssign + Clone,

Source§

fn add_assign(&mut self, c: T)

Performs the += operation. Read more
Source§

impl<M, T> AddAssign for Lms<M, T>
where T: AddAssign,

Source§

fn add_assign(&mut self, other: Lms<M, T>)

Performs the += operation. Read more
Source§

impl<M, T> ArrayCast for Lms<M, T>

Source§

type Array = [T; 3]

The output type of a cast to an array.
Source§

impl<M, T> AsMut<[T]> for Lms<M, T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, T> AsMut<[T; 3]> for Lms<M, T>

Source§

fn as_mut(&mut self) -> &mut [T; 3]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, T> AsRef<[T]> for Lms<M, T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, T> AsRef<[T; 3]> for Lms<M, T>

Source§

fn as_ref(&self) -> &[T; 3]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, T> Clamp for Lms<M, T>
where T: Clamp + Stimulus,

Source§

fn clamp(self) -> Lms<M, T>

Return a new color where out-of-bounds components have been changed to the nearest valid values. Read more
Source§

impl<M, T> ClampAssign for Lms<M, T>
where T: ClampAssign + Stimulus,

Source§

fn clamp_assign(&mut self)

Changes out-of-bounds components to the nearest valid values. Read more
Source§

impl<M, T> Clone for Lms<M, T>
where T: Clone,

Source§

fn clone(&self) -> Lms<M, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M, T> Debug for Lms<M, T>
where M: Debug, T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<M, T> Default for Lms<M, T>
where T: Default,

Source§

fn default() -> Lms<M, T>

Returns the “default value” for a type. Read more
Source§

impl<'de, M, T> Deserialize<'de> for Lms<M, T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Lms<M, T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<M, T> Div<T> for Lms<M, T>
where T: Div<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the / operator.
Source§

fn div(self, c: T) -> <Lms<M, T> as Div<T>>::Output

Performs the / operation. Read more
Source§

impl<M, T> Div for Lms<M, T>
where T: Div<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Lms<M, T>) -> <Lms<M, T> as Div>::Output

Performs the / operation. Read more
Source§

impl<M, T> DivAssign<T> for Lms<M, T>
where T: DivAssign + Clone,

Source§

fn div_assign(&mut self, c: T)

Performs the /= operation. Read more
Source§

impl<M, T> DivAssign for Lms<M, T>
where T: DivAssign,

Source§

fn div_assign(&mut self, other: Lms<M, T>)

Performs the /= operation. Read more
Source§

impl<M, T> EuclideanDistance for Lms<M, T>
where T: Sub<Output = T> + Add<Output = T> + Mul<Output = T> + Real + Clone,

Source§

type Scalar = T

The type for the distance value.
Source§

fn distance_squared( self, other: Lms<M, T>, ) -> <Lms<M, T> as EuclideanDistance>::Scalar

Calculate the squared Euclidean distance from self to other. Read more
Source§

fn distance(self, other: Self) -> Self::Scalar
where Self::Scalar: Sqrt,

Calculate the Euclidean distance from self to other.
Source§

impl<M, T, C> Extend<Lms<M, T>> for Lms<M, C>
where C: Extend<T>,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Lms<M, T>>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, M, T> From<&'a [T; 3]> for &'a Lms<M, T>

Source§

fn from(array: &'a [T; 3]) -> &'a Lms<M, T>

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a Lms<M, T>> for &'a [T]

Source§

fn from(color: &'a Lms<M, T>) -> &'a [T]

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a mut [T; 3]> for &'a mut Lms<M, T>

Source§

fn from(array: &'a mut [T; 3]) -> &'a mut Lms<M, T>

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a mut Lms<M, T>> for &'a mut [T]

Source§

fn from(color: &'a mut Lms<M, T>) -> &'a mut [T]

Converts to this type from the input type.
Source§

impl<M, T, V, const N: usize> From<[Lms<M, T>; N]> for Lms<M, V>
where [T; N]: Default, V: FromScalarArray<N, Scalar = T>,

Source§

fn from(colors: [Lms<M, T>; N]) -> Lms<M, V>

Converts to this type from the input type.
Source§

impl<M, T> From<[T; 3]> for Lms<M, T>

Source§

fn from(array: [T; 3]) -> Lms<M, T>

Converts to this type from the input type.
Source§

impl<M, T> From<(T, T, T)> for Lms<M, T>

Source§

fn from(components: (T, T, T)) -> Lms<M, T>

Converts to this type from the input type.
Source§

impl<M, T> From<Box<[T; 3]>> for Box<Lms<M, T>>

Available on crate feature alloc only.
Source§

fn from(array: Box<[T; 3]>) -> Box<Lms<M, T>>

Converts to this type from the input type.
Source§

impl<M> From<Lms<M, f32>> for Lms<M, f64>

Source§

fn from(color: Lms<M, f32>) -> Lms<M, f64>

Converts to this type from the input type.
Source§

impl<M> From<Lms<M, f64>> for Lms<M, f32>

Source§

fn from(color: Lms<M, f64>) -> Lms<M, f32>

Converts to this type from the input type.
Source§

impl<M, T> From<PreAlpha<Lms<M, T>>> for Lms<M, T>
where Lms<M, T>: Premultiply<Scalar = T>,

Source§

fn from(premultiplied: PreAlpha<Lms<M, T>>) -> Lms<M, T>

Converts to this type from the input type.
Source§

impl<M, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lms<M, T>
where _C: IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Alpha<_C, _A>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hsl<_S, T>> for Lms<M, T>
where _S: RgbStandard, <_S as RgbStandard>::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hsl<_S, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Hsl<_S, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Hsluv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Hsluv<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Hsluv<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hsv<_S, T>> for Lms<M, T>
where _S: RgbStandard, <_S as RgbStandard>::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hsv<_S, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Hsv<_S, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hwb<_S, T>> for Lms<M, T>
where _S: RgbStandard, <_S as RgbStandard>::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hwb<_S, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Hwb<_S, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lab<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lab<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Lab<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lch<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lch<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Lch<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lchuv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lchuv<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Lchuv<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Lms<M, T>> for Lms<M, T>

Source§

fn from_color_unclamped(val: Lms<M, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Lms<M, T>> for Xyz<<M as HasXyzMeta>::XyzMeta, T>

Source§

fn from_color_unclamped(val: Lms<M, T>) -> Xyz<<M as HasXyzMeta>::XyzMeta, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsl<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Rgb<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Hsl<S, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Hsl<S, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsluv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Lchuv<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Hsluv<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Hsluv<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsv<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Rgb<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Hsv<S, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Hsv<S, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hwb<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Hsv<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Hwb<S, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Hwb<S, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lab<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Lab<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Lab<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lch<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Lab<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Lch<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Lch<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lchuv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Luv<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Lchuv<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Lchuv<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Luma<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <S as LumaStandard>::WhitePoint>, S: LumaStandard, Xyz<<S as LumaStandard>::WhitePoint, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Luma<S, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Luma<S, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Luv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Luv<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Luv<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhsl<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Okhsl<T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Okhsl<T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhsv<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Okhsv<T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Okhsv<T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhwb<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Okhsv<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Okhwb<T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Okhwb<T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Oklab<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Xyz<D65, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Oklab<T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Oklab<T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Oklch<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Oklch<T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Oklch<T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Rgb<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Rgb<S, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Rgb<S, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Yxy<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Yxy<Wp, T>>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Yxy<Wp, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Luma<_S, T>> for Lms<M, T>
where _S: LumaStandard<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Luma<_S, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Luma<_S, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Luv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Luv<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Luv<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhsl<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhsl<T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhsv<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhsv<T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhwb<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhwb<T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Oklab<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Oklab<T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Oklch<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Oklch<T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Rgb<_S, T>> for Lms<M, T>
where _S: RgbStandard, <_S as RgbStandard>::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Rgb<_S, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Rgb<_S, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Xyz<<M as HasXyzMeta>::XyzMeta, T>> for Lms<M, T>

Source§

fn from_color_unclamped(val: Xyz<<M as HasXyzMeta>::XyzMeta, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Yxy<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Yxy<_Wp, T>> + IntoColorUnclamped<Lms<M, T>>,

Source§

fn from_color_unclamped(color: Yxy<_Wp, T>) -> Lms<M, T>

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, C> FromIterator<Lms<M, T>> for Lms<M, C>
where Lms<M, C>: Extend<Lms<M, T>>, C: Default,

Source§

fn from_iter<I>(iter: I) -> Lms<M, C>
where I: IntoIterator<Item = Lms<M, T>>,

Creates a value from an iterator. Read more
Source§

impl<M, T> HasBoolMask for Lms<M, T>
where T: HasBoolMask,

Source§

type Mask = <T as HasBoolMask>::Mask

The mask type to use for selecting Self values.
Source§

impl<'a, 'b, M, T> IntoIterator for &'a Lms<M, &'b [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Lms<M, &'b [T]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, 'b, M, T> IntoIterator for &'a Lms<M, &'b mut [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Lms<M, &'b mut [T]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T, const N: usize> IntoIterator for &'a Lms<M, [T; N]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Lms<M, [T; N]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a Lms<M, Box<[T]>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Lms<M, Box<[T]>> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Lms<M, Vec<T>> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, 'b, M, T> IntoIterator for &'a mut Lms<M, &'b mut [T]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Lms<M, &'b mut [T]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T, const N: usize> IntoIterator for &'a mut Lms<M, [T; N]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Lms<M, [T; N]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a mut Lms<M, Box<[T]>>
where T: 'a,

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Lms<M, Box<[T]>> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a mut Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Lms<M, Vec<T>> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for Lms<M, &'a [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Lms<M, &'a [T]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for Lms<M, &'a mut [T]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Lms<M, &'a mut [T]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T, const N: usize> IntoIterator for Lms<M, [T; N]>

Source§

type Item = Lms<M, T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IntoIter<T, N>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Lms<M, [T; N]> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T> IntoIterator for Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IntoIter<T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Lms<M, Vec<T>> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T> IsWithinBounds for Lms<M, T>
where T: PartialCmp + Stimulus, <T as HasBoolMask>::Mask: BitAnd<Output = <T as HasBoolMask>::Mask>,

Source§

fn is_within_bounds(&self) -> <T as HasBoolMask>::Mask

Check if the color’s components are within the expected range bounds. Read more
Source§

impl<M, T> Mix for Lms<M, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

Source§

type Scalar = T

The type of the mixing factor.
Source§

fn mix(self, other: Lms<M, T>, factor: T) -> Lms<M, T>

Mix the color with an other color, by factor. Read more
Source§

impl<M, T> MixAssign for Lms<M, T>
where T: Real + Zero + One + AddAssign + Arithmetics + Clamp + Clone,

Source§

type Scalar = T

The type of the mixing factor.
Source§

fn mix_assign(&mut self, other: Lms<M, T>, factor: T)

Mix the color with an other color, by factor. Read more
Source§

impl<M, T> Mul<T> for Lms<M, T>
where T: Mul<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the * operator.
Source§

fn mul(self, c: T) -> <Lms<M, T> as Mul<T>>::Output

Performs the * operation. Read more
Source§

impl<M, T> Mul for Lms<M, T>
where T: Mul<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Lms<M, T>) -> <Lms<M, T> as Mul>::Output

Performs the * operation. Read more
Source§

impl<M, T> MulAssign<T> for Lms<M, T>
where T: MulAssign + Clone,

Source§

fn mul_assign(&mut self, c: T)

Performs the *= operation. Read more
Source§

impl<M, T> MulAssign for Lms<M, T>
where T: MulAssign,

Source§

fn mul_assign(&mut self, other: Lms<M, T>)

Performs the *= operation. Read more
Source§

impl<M, T> PartialEq for Lms<M, T>
where T: PartialEq,

Source§

fn eq(&self, other: &Lms<M, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M, T> Premultiply for Lms<M, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<Output = T> + Div<Output = T> + Clone, <T as HasBoolMask>::Mask: LazySelect<T> + Clone,

Source§

type Scalar = T

The color’s component type.
Source§

fn premultiply(self, alpha: T) -> PreAlpha<Lms<M, T>>

Alpha mask the color. Read more
Source§

fn unpremultiply(premultiplied: PreAlpha<Lms<M, T>>) -> (Lms<M, T>, T)

Alpha unmask the color, resulting in a color and transparency pair. Read more
Source§

impl<M, T> RelativeEq for Lms<M, T>
where T: RelativeEq, <T as AbsDiffEq>::Epsilon: Clone,

Available on crate feature approx only.
Source§

fn default_max_relative() -> <T as AbsDiffEq>::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool

The inverse of [RelativeEq::relative_eq].
Source§

impl<M, T> SaturatingAdd<T> for Lms<M, T>
where T: SaturatingAdd<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_add(self, c: T) -> <Lms<M, T> as SaturatingAdd<T>>::Output

Returns the sum of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingAdd for Lms<M, T>
where T: SaturatingAdd<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_add( self, other: Lms<M, T>, ) -> <Lms<M, T> as SaturatingAdd>::Output

Returns the sum of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingSub<T> for Lms<M, T>
where T: SaturatingSub<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_sub(self, c: T) -> <Lms<M, T> as SaturatingSub<T>>::Output

Returns the difference of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingSub for Lms<M, T>
where T: SaturatingSub<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_sub( self, other: Lms<M, T>, ) -> <Lms<M, T> as SaturatingSub>::Output

Returns the difference of self and other, but saturates instead of overflowing.
Source§

impl<M, T> Serialize for Lms<M, T>
where T: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<M, T> Sub<T> for Lms<M, T>
where T: Sub<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the - operator.
Source§

fn sub(self, c: T) -> <Lms<M, T> as Sub<T>>::Output

Performs the - operation. Read more
Source§

impl<M, T> Sub for Lms<M, T>
where T: Sub<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Lms<M, T>) -> <Lms<M, T> as Sub>::Output

Performs the - operation. Read more
Source§

impl<M, T> SubAssign<T> for Lms<M, T>
where T: SubAssign + Clone,

Source§

fn sub_assign(&mut self, c: T)

Performs the -= operation. Read more
Source§

impl<M, T> SubAssign for Lms<M, T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, other: Lms<M, T>)

Performs the -= operation. Read more
Source§

impl<'a, M, T> TryFrom<&'a [T]> for &'a Lms<M, T>

Source§

type Error = <&'a [T; 3] as TryFrom<&'a [T]>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from( slice: &'a [T], ) -> Result<&'a Lms<M, T>, <&'a Lms<M, T> as TryFrom<&'a [T]>>::Error>

Performs the conversion.
Source§

impl<'a, M, T> TryFrom<&'a mut [T]> for &'a mut Lms<M, T>

Source§

type Error = <&'a mut [T; 3] as TryFrom<&'a mut [T]>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from( slice: &'a mut [T], ) -> Result<&'a mut Lms<M, T>, <&'a mut Lms<M, T> as TryFrom<&'a mut [T]>>::Error>

Performs the conversion.
Source§

impl<M, T> UlpsEq for Lms<M, T>
where T: UlpsEq, <T as AbsDiffEq>::Epsilon: Clone,

Available on crate feature approx only.
Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, max_ulps: u32, ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne( &self, other: &Lms<M, T>, epsilon: <T as AbsDiffEq>::Epsilon, max_ulps: u32, ) -> bool

The inverse of [UlpsEq::ulps_eq].
Source§

impl<M, T, _A> WithAlpha<_A> for Lms<M, T>
where _A: Stimulus,

Source§

type Color = Lms<M, T>

The opaque color type, without any transparency. Read more
Source§

type WithAlpha = Alpha<Lms<M, T>, _A>

The color type with transparency applied. Read more
Source§

fn with_alpha(self, alpha: _A) -> <Lms<M, T> as WithAlpha<_A>>::WithAlpha

Transforms the color into a transparent color with the provided alpha value. If Self already has a transparency, it is overwritten. Read more
Source§

fn without_alpha(self) -> <Lms<M, T> as WithAlpha<_A>>::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
Source§

fn split(self) -> (<Lms<M, T> as WithAlpha<_A>>::Color, _A)

Splits the color into separate color and transparency values. Read more
Source§

fn opaque(self) -> Self::WithAlpha
where A: Stimulus,

Transforms the color into a fully opaque color with a transparency field. If Self already has a transparency, it is overwritten. Read more
Source§

fn transparent(self) -> Self::WithAlpha
where A: Zero,

Transforms the color into a fully transparent color. If Self already has a transparency, it is overwritten. Read more
Source§

impl<M, T> Copy for Lms<M, T>
where T: Copy,

Source§

impl<M, T> Eq for Lms<M, T>
where T: Eq,

Source§

impl<M, T> StimulusColor for Lms<M, T>
where T: Stimulus,

Auto Trait Implementations§

§

impl<M, T> Freeze for Lms<M, T>
where T: Freeze,

§

impl<M, T> RefUnwindSafe for Lms<M, T>

§

impl<M, T> Send for Lms<M, T>
where T: Send, M: Send,

§

impl<M, T> Sync for Lms<M, T>
where T: Sync, M: Sync,

§

impl<M, T> Unpin for Lms<M, T>
where T: Unpin, M: Unpin,

§

impl<M, T> UnsafeUnpin for Lms<M, T>
where T: UnsafeUnpin,

§

impl<M, T> UnwindSafe for Lms<M, T>
where T: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, S: IntoColorUnclamped<Xyz<Swp, T>>, D: FromColorUnclamped<Xyz<Dwp, T>>,

Source§

fn adapt_from_using<M>(color: S, method: M) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptFromUnclamped

Convert the source color to the destination color using the specified method.
Source§

fn adapt_from(color: S) -> Self

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptFromUnclamped

Convert the source color to the destination color using the bradford method by default.
Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T, C> AdaptIntoUnclamped<T> for C
where T: AdaptFromUnclamped<C>,

Source§

type Scalar = <T as AdaptFromUnclamped<C>>::Scalar

The number type that’s used as the color’s components.
Source§

fn adapt_into_unclamped_with<M>(self) -> T

Adapt a color of type Self into a color of type T, using the custom matrix M. Read more
Source§

fn adapt_into_unclamped(self) -> T
where Bradford: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar>,

Adapt a color of type Self into a color of type T, using the Bradford matrix. Read more
§

impl<T> Also for T

§

fn also<F>(self, block: F) -> Self
where F: FnOnce(&mut Self),

Apply a function to this value and return the (possibly) modified value.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

§

impl<T, Res> Apply<Res> for T
where T: ?Sized,

§

fn apply<F>(self, f: F) -> Res
where F: FnOnce(Self) -> Res, Self: Sized,

Apply a function which takes the parameter by value.
§

fn apply_ref<F>(&self, f: F) -> Res
where F: FnOnce(&Self) -> Res,

Apply a function which takes the parameter by reference.
§

fn apply_mut<F>(&mut self, f: F) -> Res
where F: FnOnce(&mut Self) -> Res,

Apply a function which takes the parameter by mutable reference.
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<C, T, const N: usize> Blend for C
where C: Premultiply<Scalar = T> + StimulusColor + ArrayCast<Array = [T; N]> + Clone, T: Real + Zero + One + MinMax + Clamp + Sqrt + Abs + Arithmetics + PartialCmp + Clone, <T as HasBoolMask>::Mask: LazySelect<T>,

Source§

fn multiply(self, other: C) -> C

Multiply self with other. This uses the alpha component to regulate the effect, so it’s not just plain component wise multiplication.
Source§

fn screen(self, other: C) -> C

Make a color which is at least as light as self or other.
Source§

fn overlay(self, other: C) -> C

Multiply self or other if other is dark, or screen them if other is light. This results in an S curve.
Source§

fn darken(self, other: C) -> C

Return the darkest parts of self and other.
Source§

fn lighten(self, other: C) -> C

Return the lightest parts of self and other.
Source§

fn dodge(self, other: C) -> C

Lighten other to reflect self. Results in other if self is black.
Source§

fn burn(self, other: C) -> C

Darken other to reflect self. Results in other if self is white.
Source§

fn hard_light(self, other: C) -> C

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.
Source§

fn soft_light(self, other: C) -> C

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.
Source§

fn difference(self, other: C) -> C

Return the absolute difference between self and other. It’s basically abs(self - other), but regulated by the alpha component.
Source§

fn exclusion(self, other: C) -> C

Similar to difference, but appears to result in a lower contrast. other is inverted if self is white, and preserved if self is black.
Source§

impl<C> BlendWith for C

Source§

type Color = C

The base color type of Self.
Source§

fn blend_with<F>(self, other: C, blend_function: F) -> C
where F: BlendFunction<<C as BlendWith>::Color>,

Blend self, as the source color, with destination, using blend_function. Anything that implements BlendFunction is acceptable, including functions and closures. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<C> Compose for C

Source§

fn over(self, other: C) -> C

Place self over other. This is the good old common alpha composition equation.
Source§

fn inside(self, other: C) -> C

Results in the parts of self that overlaps the visible parts of other.
Source§

fn outside(self, other: C) -> C

Results in the parts of self that lies outside the visible parts of other.
Source§

fn atop(self, other: C) -> C

Place self over only the visible parts of other.
Source§

fn xor(self, other: C) -> C

Results in either self or other, where they do not overlap.
Source§

fn plus(self, other: C) -> C

Add self and other. This uses the alpha component to regulate the effect, so it’s not just plain component wise addition.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromColor<T> for U
where U: FromColorUnclamped<T> + Clamp,

Source§

fn from_color(t: T) -> U

Convert from T with values clamped to the color defined bounds. Read more
Source§

impl<T, U> FromColorMut<U> for T
where T: FromColor<U> + ArrayCast + Clone, U: FromColor<T> + ArrayCast<Array = <T as ArrayCast>::Array> + Clone,

Source§

fn from_color_mut(color: &mut U) -> FromColorMutGuard<'_, T, U>

Temporarily convert from another color type in place. Read more
Source§

impl<T, U> FromColorUnclampedMut<U> for T
where T: FromColorUnclamped<U> + ArrayCast + Clone, U: FromColorUnclamped<T> + ArrayCast<Array = <T as ArrayCast>::Array> + Clone,

Source§

fn from_color_unclamped_mut( color: &mut U, ) -> FromColorUnclampedMutGuard<'_, T, U>

Temporarily convert from another color type in place, without clamping. Read more
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
§

impl<State, Message> IntoBoot<State, Message> for State

§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorMut<T> for U
where T: FromColorMut<U> + ?Sized, U: FromColorMut<T> + ?Sized,

Source§

fn into_color_mut(&mut self) -> FromColorMutGuard<'_, T, U>

Temporarily convert to another color type in place. Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T, U> IntoColorUnclampedMut<T> for U

Source§

fn into_color_unclamped_mut(&mut self) -> FromColorUnclampedMutGuard<'_, T, U>

Temporarily convert to another color type in place, without clamping. Read more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<'a, T> ParamCurveMoments<'a> for T
where T: 'a, &'a T: IntoIterator<Item = PathEl>,

§

fn moments(&'a self) -> Moments

Returns the moment integrals for the path using Green’s theorem.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryFromColor<T> for U
where U: FromColorUnclamped<T> + IsWithinBounds<Mask = bool>,

Source§

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
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

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
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> MaybeClone for T

§

impl<T> MaybeDebug for T

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,