---
title: "Compute Maximum Chroma for Given Hue and Luminance in HCL"
---

### Description

Compute approximately the maximum chroma possible for a given hue
and luminance combination in the HCL color space.

`H` and `L` can be single values or multiple values. If both have length `>
1`, the length must match. If one is of length `1` it will be recycled to
match the length of the other argument. In case the function is not able to
create two arrays of the same length an error will be thrown.

### Usage

<pre><code class='language-python'>max_chroma(H, L, floor=False)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.utils.max_chroma:H">H</code><code class="argument-class">int, float, list, numpy.ndarray</code>
  </dt>
 <dd>hue, one or multiple values (must be
convertable to float).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.utils.max_chroma:L">L</code><code class="argument-class">int, float, list, numpy.ndarray</code>
  </dt>
 <dd>luminance, one or multiple values (must be
convertable to float).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.utils.max_chroma:floor">floor</code><code class="argument-class">bool</code>
  </dt>
 <dd>should return be rounded? Defaults to `False`.</dd>
</dl>

### Return

<code>numpy.ndarray</code>: Array of the same length as `max(len(H), len(L))` with
maximum possible chroma for these hue-luminance combinations.

### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import max_chroma
# Max Chroma for Hue = 0 (red) with Luminance = 50
max_chroma(0, 50)
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Max Chroma for Hue = 0 (red) for different Luminance levels
max_chroma(0, [25, 50, 75])
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Max Chroma for Hue in sequence [0, 360] by 60, Luminace = 50
import numpy as np
max_chroma(np.arange(0, 360, 60), 50)

```

```{python}
#| echo: true
#| warning: true
#| error: true
# Same as above but floored
max_chroma(np.arange(0, 360, 60), 50, floor = True)
```




### Raises

<ul class="python-raises">
<li><code class="text-warning">TypeError</code>: If unexpected input on `H` or `L`.
<li><code class="text-warning">TypeError</code>: If length of `H` and `L` do not match (see description).
<li><code class="text-warning">TypeError</code>: If input `floor` is not bool.
</ul>

