# `Color.LCHab`

Cylindrical representation of CIE `L*a*b*`: lightness, chroma, hue.

The `h` hue is expressed in degrees in `[0, 360)`.

# `t`

```elixir
@type t() :: %Color.LCHab{
  alpha: number() | nil,
  c: number() | nil,
  h: number() | nil,
  illuminant: atom(),
  l: number() | nil,
  observer_angle: 2 | 10
}
```

# `from_lab`

Converts an `L*a*b*` color to `LCHab`.

### Arguments

* `lab` is a `Color.Lab` struct.

### Returns

* A `Color.LCHab` struct.

### Examples

    iex> lab = %Color.Lab{l: 50.0, a: 0.0, b: 0.0}
    iex> {:ok, lch} = Color.LCHab.from_lab(lab)
    iex> {lch.l, lch.c, lch.h}
    {50.0, 0.0, 0.0}

# `from_xyz`

Converts a CIE `XYZ` color to `LCHab` via `L*a*b*`.

### Arguments

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

### Returns

* A `Color.LCHab` struct.

### Examples

    iex> xyz = %Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2}
    iex> {:ok, lch} = Color.LCHab.from_xyz(xyz)
    iex> {Float.round(lch.l, 2), Float.round(lch.c, 5)}
    {100.0, 0.0}

# `to_lab`

Converts an `LCHab` color to `L*a*b*`.

### Arguments

* `lch` is a `Color.LCHab` struct.

### Returns

* A `Color.Lab` struct.

### Examples

    iex> {:ok, lab} = Color.LCHab.to_lab(%Color.LCHab{l: 50.0, c: 0.0, h: 0.0})
    iex> {lab.l, lab.a, lab.b}
    {50.0, 0.0, 0.0}

# `to_xyz`

Converts an `LCHab` color to CIE `XYZ` via `L*a*b*`.

### Arguments

* `lch` is a `Color.LCHab` struct.

### Returns

* A `Color.XYZ` struct.

### Examples

    iex> {:ok, xyz} = Color.LCHab.to_xyz(%Color.LCHab{l: 100.0, c: 0.0, h: 0.0})
    iex> {Float.round(xyz.x, 4), Float.round(xyz.y, 4), Float.round(xyz.z, 4)}
    {0.9505, 1.0, 1.0888}

---

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