Color.Luv
(Color v0.4.0)
Copy Markdown
CIE 1976 L*u*v* color space.
Conversions use the Lindbloom formulas with exact CIE constants
ε = 216/24389 and κ = 24389/27.
Summary
Types
Functions
Converts a CIE XYZ color to an L*u*v* color.
Arguments
xyzis aColor.XYZstruct.
Returns
- A
Color.Luvstruct tagged with the same illuminant and observer angle as the inputxyz.
Examples
iex> xyz = %Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2}
iex> {:ok, luv} = Color.Luv.from_xyz(xyz)
iex> {Float.round(luv.l, 3), Float.round(luv.u, 3), Float.round(luv.v, 3)}
{100.0, 0.0, 0.0}
Converts an L*u*v* color to a CIE XYZ color.
Arguments
luvis aColor.Luvstruct.optionsis a keyword list.
Options
:illuminantoverrides the reference-white illuminant from theluvstruct. Defaults toluv.illuminant.:observer_angleoverrides the observer angle. Defaults toluv.observer_angle.
Returns
- A
Color.XYZstruct.
Examples
iex> {:ok, xyz} = Color.Luv.to_xyz(%Color.Luv{l: 100.0, u: 0.0, v: 0.0})
iex> {Float.round(xyz.x, 4), Float.round(xyz.y, 4), Float.round(xyz.z, 4)}
{0.9505, 1.0, 1.0888}