---
title: "HCL Based Terrain Color Palette"
---

### Description

`terrain_hcl` is an implementation of the base _R_ 'terrain.colors' palette but
constructed in HCL space based on a call to [sequential_hcl](colorspace.palettes.sequential_hcl.qmd). 

See also: [qualitative_hcl](colorspace.palettes.qualitative_hcl.qmd), [sequential_hcl](colorspace.palettes.sequential_hcl.qmd),
[diverging_hcl](colorspace.palettes.diverging_hcl.qmd), [divergingx_hcl](colorspace.palettes.divergingx_hcl.qmd),
[rainbow_hcl](colorspace.palettes.rainbow_hcl.qmd), [heat_hcl](colorspace.palettes.heat_hcl.qmd), [diverging_hsv](colorspace.palettes.diverging_hsv.qmd),
and [rainbow](colorspace.palettes.rainbow.qmd).

### Usage

<pre><code class='language-python'>terrain_hcl(h=[130, 0], c=[80, 0], l=[60, 95],<br/>            power=[0.1, 1.0], fixup=True, rev=False,<br/>            *args, **kwargs)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:h">h</code><code class="argument-class">list of int</code>
  </dt>
 <dd>Hue parameters (h1/h2).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:c">c</code><code class="argument-class">list of int</code>
  </dt>
 <dd>Chroma parameters (c1/c2).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:l">l</code><code class="argument-class">int</code>
  </dt>
 <dd>Luminance parameters (l1/l2).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:power">power</code><code class="argument-class">list of float</code>
  </dt>
 <dd>Power parameters (p1/p2).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:fixup">fixup</code><code class="argument-class">bool</code>
  </dt>
 <dd>Only used when converting the HCL colors to hex.  Should
RGB values outside the defined RGB color space be corrected?</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:rev">rev</code><code class="argument-class">bool</code>
  </dt>
 <dd>Should the color map be reversed.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:*args">*args</code>
  </dt>
 <dd>unused.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.terrain_hcl:**kwargs">**kwargs</code>
  </dt>
 <dd>Additional arguments to overwrite the h/c/l settings.
Allowed: `h1`, `h2`, `c1`, `c2`, `l1`, `l2`, `p1`, `p2`.</dd>
</dl>

### Return

Initialize new object, no return. Raises a set of errors if the parameters
are misspecified. Note that the object is callable, the default object call
can be used to return hex colors (identical to the `.colors()` method),
see examples.

### Methods

<dl class="pyp-list method-list">
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.cmap(n=256, name=&#x27;custom_hcl_cmap&#x27;)](colorspace.palettes.terrain_hcl.cmap.qmd)</code>
    </dt>
    <dd>Create Matplotlib Compatible Color Map</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.colors(n=11, fixup=None, alpha=None, **kwargs)](colorspace.palettes.terrain_hcl.colors.qmd)</code>
    </dt>
    <dd>Get Colors</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.get(key)](colorspace.palettes.terrain_hcl.get.qmd)</code>
    </dt>
    <dd>Get Specific Palette Setting</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.hclplot(n=7, **kwargs)](colorspace.palettes.terrain_hcl.hclplot.qmd)</code>
    </dt>
    <dd>Palette Plot in HCL Space</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.name()](colorspace.palettes.terrain_hcl.name.qmd)</code>
    </dt>
    <dd>Get Palette Name</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.show_settings()](colorspace.palettes.terrain_hcl.show_settings.qmd)</code>
    </dt>
    <dd>Show Palette Settings</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.specplot(n=180, *args, **kwargs)](colorspace.palettes.terrain_hcl.specplot.qmd)</code>
    </dt>
    <dd>Color Spectrum Plot</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[terrain_hcl.swatchplot(n=7, **kwargs)](colorspace.palettes.terrain_hcl.swatchplot.qmd)</code>
    </dt>
    <dd>Palette Swatch Plot</dd>
</dl>


### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import terrain_hcl
pal = terrain_hcl()
pal.colors(10)
```

```{python}
#| echo: true
#| warning: true
#| error: true
pal.swatchplot(show_names = False, figsize = (5.5, 0.5));
```

```{python}
#| echo: true
#| warning: true
#| error: true
# The standard call of the object also returns hex colors
terrain_hcl()(10)
```



