Color.XyY
(Color v0.4.0)
Copy Markdown
CIE xyY color space — chromaticity coordinates x, y and luminance Y.
Conversions use the Lindbloom formulas. The Y channel carries the
luminance on the same scale as CIE XYZ (typically Y ∈ [0, 1]).
Summary
Types
CIE xyY chromaticity (x, y) plus luminance (yY). Useful for
reasoning about gamut on a chromaticity diagram.
Types
@type t() :: %Color.XyY{ alpha: Color.Types.alpha(), illuminant: Color.Types.illuminant(), observer_angle: Color.Types.observer(), x: float() | nil, y: float() | nil, yY: float() | nil }
CIE xyY chromaticity (x, y) plus luminance (yY). Useful for
reasoning about gamut on a chromaticity diagram.
Functions
Converts a CIE XYZ color to xyY.
When X + Y + Z = 0 the chromaticity is taken from the xyz's
reference white, as prescribed by Lindbloom.
Arguments
xyzis aColor.XYZstruct.
Returns
- A
Color.XyYstruct.
Examples
iex> xyz = %Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2}
iex> {:ok, xyy} = Color.XyY.from_xyz(xyz)
iex> {Float.round(xyy.x, 5), Float.round(xyy.y, 5), Float.round(xyy.yY, 4)}
{0.31273, 0.32902, 1.0}
Converts an xyY color to CIE XYZ.
Arguments
xyyis aColor.XyYstruct.
Returns
- A
Color.XYZstruct.
Examples
iex> {:ok, xyz} = Color.XyY.to_xyz(%Color.XyY{x: 0.31271, y: 0.32902, yY: 1.0})
iex> {Float.round(xyz.x, 4), Float.round(xyz.y, 4), Float.round(xyz.z, 4)}
{0.9504, 1.0, 1.0889}