---
title: "Extract Hex Colors"
---

### Description

Convers the current object into an object of class [hexcols](colorspace.colorlib.hexcols.qmd)
and extracts the hex colors as list of str.

If the object contains alpha values, the alpha level is added to the
hex string if and only if alpha is not equal to `1.0`.

### Usage

<pre><code class='language-python'>HCL.colors(fixup=True, rev=False)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.colorlib.HCL.colors:fixup">fixup</code><code class="argument-class">bool</code>
  </dt>
 <dd>Whether or not to correct rgb values outside the
defined range of `[0., 1.]`, defaults to `True`.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.colorlib.HCL.colors:rev">rev</code><code class="argument-class">bool</code>
  </dt>
 <dd>Should the color palette be reversed? Defaults to `False`.</dd>
</dl>

### Return

<code>list</code>: Returns a list of hex color strings.

### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import HCL, sRGB, HSV
# Example using HCL colors
cols = HCL([0, 40, 80],
           [30, 60, 80],
           [85, 60, 35])
cols.colors()
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Example using sRGB colors
cols = sRGB([0.01, 0.89, 0.56],
            [0.25, 0.89, 0.02],
            [0.65, 0.89, 0.23])
cols.colors()
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Example using HSV colors
cols = HSV([218, 0, 336],
           [1, 0, 1],
           [0.65, 0.89, 0.56])
cols.colors()
```



