# `Color.XyY`

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]`).

# `t`

```elixir
@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.

# `from_xyz`

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

* `xyz` is a `Color.XYZ` struct.

### Returns

* A `Color.XyY` struct.

### 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}

# `to_xyz`

Converts an `xyY` color to CIE `XYZ`.

### Arguments

* `xyy` is a `Color.XyY` struct.

### Returns

* A `Color.XYZ` struct.

### 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}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
