---
title: "Simulate Color Vision Deficiency"
---

### Description

Transformation of colors by simulating color vision deficiencies, based on
a CVD transform matrix. This function is an interface to the CVD object and
returns simulated colors for protanope vision.

See also [deutan](colorspace.CVD.deutan.qmd), [tritan](colorspace.CVD.tritan.qmd), [desaturate](colorspace.CVD.desaturate.qmd), and
[cvd_image](colorspace.cvd_image.cvd_image.qmd).

### Usage

<pre><code class='language-python'>protan(cols, severity=1.0, linear=True)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.CVD.protan:cols">cols</code><code class="argument-class">list, colorobject, matplotlib.colors.LinearSegmentedColormap</code>
  </dt>
 <dd>A list of valid hex colors (str)
or a colorobject (such as RGB, HCL, CIEXYZ).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.CVD.protan:severity">severity</code><code class="argument-class">float</code>
  </dt>
 <dd>Severity in `[0., 1.]`. Zero means no deficiency, one
maximum deficiency, defaults to `1.`.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.CVD.protan:linear">linear</code><code class="argument-class">bool</code>
  </dt>
 <dd>Should the color vision deficiency transformation be applied to the
linearised RGB coordinates (default)? If `False`, the transformation is applied to the
gamma-corrected sRGB coordinates (as in the Machado et al. 2009 supplementary materials).</dd>
</dl>

### Return

<code>colorobject</code>: Returns an object of the same type as the input object
`cols` with modified colors as people with protanope color vision
might see the colors (simulated).

### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import rainbow_hcl, protan, palette
from colorspace import specplot, swatchplot
# Drawing 100 colors along the HCL rainbow color palette
cols = rainbow_hcl()(100)
specplot(cols);
```

```{python}
#| echo: true
#| warning: true
#| error: true
specplot(protan(cols));
```

```{python}
#| echo: true
#| warning: true
#| error: true
specplot(protan(cols, 0.5));
```

```{python}
#| echo: true
#| warning: true
#| error: true
# List of (hex) colors
cols = ["magenta", "red", "orange", "#F2F204", "#6BF204", "#4DA00D"]
protan(cols);
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Visualize original and simulated color swatches
swatchplot([cols, protan(cols)],
           show_names = False, figsize = (5, 1.5));
```

```{python}
#| echo: true
#| warning: true
#| error: true
# From palette object
pal = palette(cols, name = "custom palette")
protan(pal)
```

```{python}
#| echo: true
#| warning: true
#| error: true
# From cmap (returns cmap)
protan(pal.cmap())
```



