# `Color.HSL`

HSL color space — hue, saturation, lightness.

All channels are unit floats in `[0, 1]`. HSL is a non-linear
reparameterisation of sRGB, so conversions to any CIE space route
through `Color.SRGB`.

# `t`

```elixir
@type t() :: %Color.HSL{
  alpha: Color.Types.alpha(),
  h: float() | nil,
  l: float() | nil,
  s: float() | nil
}
```

A non-linear HSL reparameterisation of sRGB. All three components
are unit floats: `h` in `[0.0, 1.0]` (one full turn), `s` and `l`
in `[0.0, 1.0]`.

# `from_srgb`

Converts an sRGB color to HSL.

### Arguments

* `srgb` is a `Color.SRGB` struct with unit-range channels.

### Returns

* A `Color.HSL` struct.

### Examples

    iex> {:ok, hsl} = Color.HSL.from_srgb(%Color.SRGB{r: 1.0, g: 0.0, b: 0.0})
    iex> {hsl.h, hsl.s, hsl.l}
    {0.0, 1.0, 0.5}

# `from_xyz`

Converts a CIE `XYZ` color to HSL via sRGB.

### Arguments

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

### Returns

* A `Color.HSL` struct.

# `to_srgb`

Converts an HSL color to sRGB.

### Arguments

* `hsl` is a `Color.HSL` struct.

### Returns

* A `Color.SRGB` struct with unit-range channels.

### Examples

    iex> {:ok, srgb} = Color.HSL.to_srgb(%Color.HSL{h: 0.0, s: 1.0, l: 0.5})
    iex> {srgb.r, srgb.g, srgb.b}
    {1.0, 0.0, 0.0}

# `to_xyz`

Converts an HSL color to CIE `XYZ` via sRGB.

### Arguments

* `hsl` is a `Color.HSL` struct.

### Returns

* A `Color.XYZ` struct.

---

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