---
title: "Transform Color Space"
---

### Description

Allows to transform the current object into a different color space,
if possible. Converting the colors of the current object into
another color space. After calling this method, the object
will be of a different class.

### Usage

<pre><code class='language-python'>HSV.to(to, fixup=True)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.colorlib.HSV.to:to">to</code><code class="argument-class">str</code>
  </dt>
 <dd>Name of the color space into which the colors should be
converted (e.g., `"CIEXYZ"`, `"HCL"`, `"hex"`, `"sRGB"`, ...).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.colorlib.HSV.to:fixup">fixup</code><code class="argument-class">bool</code>
  </dt>
 <dd>Whether or not colors outside the defined rgb color space
should be corrected if necessary, defaults to `True`.</dd>
</dl>

### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import HSV
x = HSV([ 264, 314,     8,   44],
        [0.80, 0.83, 0.57, 0.33],
        [0.57, 0.75, 0.95, 0.91])
x
```

```{python}
#| echo: true
#| warning: true
#| error: true
type(x)
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Convert colors to HLS
x.to("HLS")
x
```

```{python}
#| echo: true
#| warning: true
#| error: true
type(x)
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Convert colors to HSV
x.to("HSV")
x
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Extracting hex colors (returns list of str)
x.colors()
```



