lightningcss::values::color

Struct OKLCH

Source
pub struct OKLCH {
    pub l: f32,
    pub c: f32,
    pub h: f32,
    pub alpha: f32,
}
Expand description

A color in the OKLCH color space.

Fields§

§l: f32

The lightness component.

§c: f32

The chroma component.

§h: f32

The hue component.

§alpha: f32

The alpha component.

Trait Implementations§

Source§

impl Clone for OKLCH

Source§

fn clone(&self) -> OKLCH

Returns a copy 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 ColorGamut for OKLCH

Source§

fn in_gamut(&self) -> bool

Returns whether the color is within the gamut of the color space.
Source§

fn clip(&self) -> Self

Clips the color so that it is within the gamut of the color space.
Source§

impl ColorSpace for OKLCH

Source§

fn components(&self) -> (f32, f32, f32, f32)

Returns the raw color component values.
Source§

fn channels(&self) -> (&'static str, &'static str, &'static str)

Returns the channel names for this color space.
Source§

fn types(&self) -> (ChannelType, ChannelType, ChannelType)

Returns the channel types for this color space.
Source§

fn resolve_missing(&self) -> Self

Resolves missing color components (e.g. none keywords) in the color.
Source§

fn resolve(&self) -> Self

Returns a resolved color by replacing missing (i.e. none) components with zero, and performing gamut mapping to ensure the color can be represented within the color space.
Source§

impl Debug for OKLCH

Source§

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

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

impl<'de> Deserialize<'de> for OKLCH

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl From<A98> for OKLCH

Source§

fn from(t: A98) -> OKLCH

Converts to this type from the input type.
Source§

impl From<FloatColor> for OKLCH

Source§

fn from(color: FloatColor) -> OKLCH

Converts to this type from the input type.
Source§

impl From<HSL> for OKLCH

Source§

fn from(t: HSL) -> OKLCH

Converts to this type from the input type.
Source§

impl From<HWB> for OKLCH

Source§

fn from(t: HWB) -> OKLCH

Converts to this type from the input type.
Source§

impl From<LAB> for OKLCH

Source§

fn from(t: LAB) -> OKLCH

Converts to this type from the input type.
Source§

impl From<LABColor> for OKLCH

Source§

fn from(color: LABColor) -> OKLCH

Converts to this type from the input type.
Source§

impl From<LCH> for OKLCH

Source§

fn from(t: LCH) -> OKLCH

Converts to this type from the input type.
Source§

impl From<OKLAB> for OKLCH

Source§

fn from(lab: OKLAB) -> OKLCH

Converts to this type from the input type.
Source§

impl From<OKLCH> for A98

Source§

fn from(t: OKLCH) -> A98

Converts to this type from the input type.
Source§

impl From<OKLCH> for CssColor

Source§

fn from(color: OKLCH) -> CssColor

Converts to this type from the input type.
Source§

impl From<OKLCH> for HSL

Source§

fn from(t: OKLCH) -> HSL

Converts to this type from the input type.
Source§

impl From<OKLCH> for HWB

Source§

fn from(t: OKLCH) -> HWB

Converts to this type from the input type.
Source§

impl From<OKLCH> for LAB

Source§

fn from(t: OKLCH) -> LAB

Converts to this type from the input type.
Source§

impl From<OKLCH> for LABColor

Source§

fn from(color: OKLCH) -> LABColor

Converts to this type from the input type.
Source§

impl From<OKLCH> for LCH

Source§

fn from(t: OKLCH) -> LCH

Converts to this type from the input type.
Source§

impl From<OKLCH> for OKLAB

Source§

fn from(lch: OKLCH) -> OKLAB

Converts to this type from the input type.
Source§

impl From<OKLCH> for P3

Source§

fn from(t: OKLCH) -> P3

Converts to this type from the input type.
Source§

impl From<OKLCH> for ProPhoto

Source§

fn from(t: OKLCH) -> ProPhoto

Converts to this type from the input type.
Source§

impl From<OKLCH> for RGBA

Source§

fn from(t: OKLCH) -> RGBA

Converts to this type from the input type.
Source§

impl From<OKLCH> for Rec2020

Source§

fn from(t: OKLCH) -> Rec2020

Converts to this type from the input type.
Source§

impl From<OKLCH> for SRGB

Source§

fn from(t: OKLCH) -> SRGB

Converts to this type from the input type.
Source§

impl From<OKLCH> for SRGBLinear

Source§

fn from(t: OKLCH) -> SRGBLinear

Converts to this type from the input type.
Source§

impl From<OKLCH> for XYZd50

Source§

fn from(t: OKLCH) -> XYZd50

Converts to this type from the input type.
Source§

impl From<OKLCH> for XYZd65

Source§

fn from(t: OKLCH) -> XYZd65

Converts to this type from the input type.
Source§

impl From<P3> for OKLCH

Source§

fn from(t: P3) -> OKLCH

Converts to this type from the input type.
Source§

impl From<PredefinedColor> for OKLCH

Source§

fn from(color: PredefinedColor) -> OKLCH

Converts to this type from the input type.
Source§

impl From<ProPhoto> for OKLCH

Source§

fn from(t: ProPhoto) -> OKLCH

Converts to this type from the input type.
Source§

impl From<RGBA> for OKLCH

Source§

fn from(t: RGBA) -> OKLCH

Converts to this type from the input type.
Source§

impl From<Rec2020> for OKLCH

Source§

fn from(t: Rec2020) -> OKLCH

Converts to this type from the input type.
Source§

impl From<SRGB> for OKLCH

Source§

fn from(t: SRGB) -> OKLCH

Converts to this type from the input type.
Source§

impl From<SRGBLinear> for OKLCH

Source§

fn from(t: SRGBLinear) -> OKLCH

Converts to this type from the input type.
Source§

impl From<XYZd50> for OKLCH

Source§

fn from(t: XYZd50) -> OKLCH

Converts to this type from the input type.
Source§

impl From<XYZd65> for OKLCH

Source§

fn from(t: XYZd65) -> OKLCH

Converts to this type from the input type.
Source§

impl Interpolate for OKLCH

Source§

fn adjust_powerless_components(&mut self)

Adjusts components that are powerless to be NaN.
Source§

fn adjust_hue(&mut self, other: &mut Self, method: HueInterpolationMethod)

Adjusts the color hue according to the given hue interpolation method.
Source§

fn premultiply(&mut self)

Premultiplies the color by its alpha value.
Source§

fn unpremultiply(&mut self, alpha_multiplier: f32)

Un-premultiplies the color by the given alpha multiplier.
Source§

fn fill_missing_components(&mut self, other: &Self)

Fills missing components (represented as NaN) to match the other color to interpolate with.
Source§

fn interpolate(&self, p1: f32, other: &Self, p2: f32) -> Self

Interpolates the color with another using the given amounts of each.
Source§

impl JsonSchema for OKLCH

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for OKLCH

Source§

fn eq(&self, other: &OKLCH) -> 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 Serialize for OKLCH

Source§

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

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

impl TryFrom<&CssColor> for OKLCH

Source§

type Error = ()

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

fn try_from(color: &CssColor) -> Result<OKLCH, ()>

Performs the conversion.
Source§

impl TryFrom<CssColor> for OKLCH

Source§

type Error = ()

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

fn try_from(color: CssColor) -> Result<OKLCH, ()>

Performs the conversion.
Source§

impl<'i, __T: Visit<'i, __T, __V>, __V: ?Sized + Visitor<'i, __T>> Visit<'i, __T, __V> for OKLCH

Source§

const CHILD_TYPES: VisitTypes = _

Available on crate feature visitor only.
The types of values contained within this value and its children. This is used to skip branches that don’t have any values requested by the Visitor.
Source§

fn visit_children(&mut self, visitor: &mut __V) -> Result<(), __V::Error>

Available on crate feature visitor only.
Visit the children of this value.
Source§

fn visit(&mut self, visitor: &mut V) -> Result<(), V::Error>

Available on crate feature visitor only.
Visits the value by calling an appropriate method on the Visitor. If no corresponding visitor method exists, then the children are visited.
Source§

impl Copy for OKLCH

Source§

impl StructuralPartialEq for OKLCH

Auto Trait Implementations§

§

impl Freeze for OKLCH

§

impl RefUnwindSafe for OKLCH

§

impl Send for OKLCH

§

impl Sync for OKLCH

§

impl Unpin for OKLCH

§

impl UnwindSafe for OKLCH

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
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, 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,