CieLuv Struct

A color in the CIE 1976 L*u*v* color space (CIELUV), relative to a white, CieXyz.D50 by default.

public readonly struct CieLuv : IEquatable<CieLuv>

Remarks

The equations are those of CIE 15:2004 with the exact constants (6/29)^3 and (29/3)^3: the lightness is that of CIELAB, and u* and v* are the distances of the chromaticity (u', v') of the color from the one of the white. Black has no chromaticity: its u* and v* are 0.

The values are not validated: colors outside the gamut of every display and values that are not numbers are kept as they are.

Implements

Constructors

NameDescription
CieLuv(double, double, double)Initializes a new instance of the CieLuv struct.

CieLuv(double, double, double)

CieLuv.cs

Initializes a new instance of the CieLuv struct.

public CieLuv(double l, double u, double v)

Parameters

l double
The lightness, from 0 (black) to 100 (the white).
u double
The u* axis, green (negative) to red (positive).
v double
The v* axis, blue (negative) to yellow (positive).

Properties

NameDescription
LGets the lightness, from 0 (black) to 100 (the white).
UGets the u* axis, green (negative) to red (positive).
VGets the v* axis, blue (negative) to yellow (positive).

Gets the lightness, from 0 (black) to 100 (the white).

public double L { get; }

Property value

double

Gets the u* axis, green (negative) to red (positive).

public double U { get; }

Property value

double

Gets the v* axis, blue (negative) to yellow (positive).

public double V { get; }

Property value

double

Methods

NameDescription
Equals(CieLuv)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromRgb(Rgba32, RgbColorSpace?)Converts an 8-bit RGB color to CieLuv. Alpha is ignored.
FromRgb(Rgba64, RgbColorSpace?)Converts a 16-bit RGB color to CieLuv. Alpha is ignored.
FromXyz(CieXyz)Converts a color from CIEXYZ relative to CieXyz.D50.
FromXyz(CieXyz, CieXyz)Converts a color from CIEXYZ relative to a white.
GetHashCode()Returns the hash code for this instance.
ToRgba32(RgbColorSpace?)Converts this color to an opaque 8-bit RGB color, clipped to the gamut of the space component by component.
ToRgba64(RgbColorSpace?)Converts this color to an opaque 16-bit RGB color, clipped to the gamut of the space component by component.
ToString()Returns the fully qualified type name of this instance.
ToXyz()Converts this color to CIEXYZ relative to CieXyz.D50.
ToXyz(CieXyz)Converts this color to CIEXYZ relative to a white.

Equals overloads

Equals(CieLuv)

CieLuv.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(CieLuv other)
Parameters
other CieLuv
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

CieLuv.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromRgb overloads

FromRgb(Rgba32, RgbColorSpace?)

CieLuv.cs

Converts an 8-bit RGB color to CieLuv. Alpha is ignored.

public static CieLuv FromRgb(Rgba32 color, RgbColorSpace? colorSpace = null)
Parameters
color Rgba32
The color.
colorSpace RgbColorSpace?
The meaning of the red, green and blue values, or null for RgbColorSpace.Srgb.
Returns

CieLuv The color.

FromRgb(Rgba64, RgbColorSpace?)

CieLuv.cs

Converts a 16-bit RGB color to CieLuv. Alpha is ignored.

public static CieLuv FromRgb(Rgba64 color, RgbColorSpace? colorSpace = null)
Parameters
color Rgba64
The color.
colorSpace RgbColorSpace?
The meaning of the red, green and blue values, or null for RgbColorSpace.Srgb.
Returns

CieLuv The color.

FromXyz overloads

FromXyz(CieXyz)

CieLuv.cs

Converts a color from CIEXYZ relative to CieXyz.D50.

public static CieLuv FromXyz(CieXyz xyz)
Parameters
xyz CieXyz
The color.
Returns

CieLuv The color.

FromXyz(CieXyz, CieXyz)

CieLuv.cs

Converts a color from CIEXYZ relative to a white.

public static CieLuv FromXyz(CieXyz xyz, CieXyz whitePoint)
Parameters
xyz CieXyz
The color.
whitePoint CieXyz
The white the color is relative to: it has a lightness of 100 and no chroma.
Returns

CieLuv The color.

GetHashCode()

CieLuv.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToRgba32(RgbColorSpace?)

CieLuv.cs

Converts this color to an opaque 8-bit RGB color, clipped to the gamut of the space component by component.

public Rgba32 ToRgba32(RgbColorSpace? colorSpace = null)

Parameters

colorSpace RgbColorSpace?
The meaning of the red, green and blue values, or null for RgbColorSpace.Srgb.

Returns

Rgba32 The color.

Exceptions

UnsupportedImageFeatureException
The space cannot convert colors to RGB values (RgbColorSpace.CanConvertFromXyz).

ToRgba64(RgbColorSpace?)

CieLuv.cs

Converts this color to an opaque 16-bit RGB color, clipped to the gamut of the space component by component.

public Rgba64 ToRgba64(RgbColorSpace? colorSpace = null)

Parameters

colorSpace RgbColorSpace?
The meaning of the red, green and blue values, or null for RgbColorSpace.Srgb.

Returns

Rgba64 The color.

Exceptions

UnsupportedImageFeatureException
The space cannot convert colors to RGB values (RgbColorSpace.CanConvertFromXyz).

ToString()

CieLuv.cs

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string The fully qualified type name.

ToXyz overloads

ToXyz()

CieLuv.cs

Converts this color to CIEXYZ relative to CieXyz.D50.

public CieXyz ToXyz()
Returns

CieXyz The color.

ToXyz(CieXyz)

CieLuv.cs

Converts this color to CIEXYZ relative to a white.

public CieXyz ToXyz(CieXyz whitePoint)
Parameters
whitePoint CieXyz
The white this color is relative to.
Returns

CieXyz The color; black when the lightness is 0.

Operators

NameDescription
operator ==(CieLuv, CieLuv)Compares two colors for equality, component by component.
operator !=(CieLuv, CieLuv)Compares two colors for inequality, component by component.

operator ==(CieLuv, CieLuv)

CieLuv.cs

Compares two colors for equality, component by component.

public static bool operator ==(CieLuv left, CieLuv right)

Parameters

left CieLuv
The first color.
right CieLuv
The second color.

Returns

bool true if all the components are equal; otherwise false.

operator !=(CieLuv, CieLuv)

CieLuv.cs

Compares two colors for inequality, component by component.

public static bool operator !=(CieLuv left, CieLuv right)

Parameters

left CieLuv
The first color.
right CieLuv
The second color.

Returns

bool true if a component differs; otherwise false.