> For the complete documentation index, see [llms.txt](https://developers.felt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.felt.com/felt-style-language/colors-and-palettes.md).

# Colors & palettes

Colors appear throughout the Felt Style Language — in `paint` (`color`, `strokeColor`), in `label` (`color`, `haloColor`), and in legends. There are three ways to express a color:

1. **A literal color** — a hex, HSL, or RGB string.
2. **A smart color** — the keyword `"auto"`, which Felt resolves to a contrasting color at render time.
3. **A palette shortcut** — a named, multi-color ramp like `@galaxy`, used by data-driven (categorical, numeric, heatmap, H3) visualizations.

## Literal colors

Any of these string formats are accepted wherever a single color is expected:

```json
{
  "color": "#3B82F6",
  "strokeColor": "hsl(217, 80%, 40%)",
  "haloColor": "rgb(38, 113, 0)"
}
```

`rgba(...)` is also supported and is handy for fully-transparent fills (for example, a transparent "Other"/background class in a categorical raster: `"rgba(0, 0, 0, 0)"`).

## Smart color: `"auto"`

`"auto"` computes a contrasting color automatically, based on the current map theme and the colors around it. It keeps strokes and label halos legible without hard-coding a value that might clash on a dark basemap or against a particular fill.

Prefer `"auto"` for:

* `strokeColor` on points and polygons
* `color` and `haloColor` on labels

…unless a specific color has been requested.

```json
{
  "paint": {
    "color": "#8F7EBF",
    "strokeColor": "auto",
    "strokeWidth": 1
  },
  "label": {
    "color": "auto",
    "haloColor": "auto",
    "haloWidth": 1.5
  }
}
```

## Palette shortcuts

For any **data-driven** visualization, prefer a named palette over a hand-built color array. Palettes are referenced with an `@` prefix (for example `"color": "@galaxy"`) and Felt expands them to the right number of colors for your classes or categories.

{% hint style="info" %}
Only the palette names listed below are valid. Use **sequential** palettes for single-direction data (population, elevation), and **diverging** palettes for data with a meaningful midpoint (change from a baseline, temperature anomaly). Reserve literal hex/HSL colors for simple (uniform) styles or when a specific color is requested.
{% endhint %}

### Vector palettes

Used by categorical, numeric, heatmap, and H3 visualizations on points, lines, and polygons.

#### Sequential (low → high)

| Palette      | Description                        |
| ------------ | ---------------------------------- |
| `@galaxy`    | Purple to yellow (popular default) |
| `@ylRed`     | Yellow to red                      |
| `@ylGrn`     | Yellow to green                    |
| `@purpYl`    | Purple to yellow                   |
| `@pinkYl`    | Pink to yellow                     |
| `@lightning` | Lightning gradient                 |
| `@copper`    | Copper gradient                    |
| `@spruce`    | Spruce green                       |
| `@riverine`  | Water gradient                     |
| `@neptune`   | Blue gradient                      |
| `@violet`    | Violet gradient                    |
| `@purple`    | Purple gradient                    |

#### Diverging (two directions from a center)

| Palette   | Description                      |
| --------- | -------------------------------- |
| `@bluRd`  | Blue to red                      |
| `@tealOr` | Teal to orange (colorblind-safe) |
| `@bluBr`  | Blue to brown                    |
| `@grnOr`  | Green to orange                  |
| `@purGrn` | Purple to green                  |
| `@weath`  | Weather gradient                 |

#### Categorical (distinct colors)

| Palette                         | Description                    |
| ------------------------------- | ------------------------------ |
| `@catPalette1` … `@catPalette7` | Categorical color schemes      |
| `@catPalettePT1`                | Paul Tol categorical palette 1 |
| `@catPalettePT2`                | Paul Tol categorical palette 2 |

Sequential and diverging vector palettes also come in numbered variants that request a specific number of colors — for example `@galaxy7`, `@galaxy8`, `@galaxy9`. Variants exist for 7, 8, and 9 colors (`@lightning` also has a 6-color variant). The unnumbered name lets Felt pick the right count for you, which is usually what you want.

### Heatmap palettes

Used by `heatmap` visualizations, ordered from least to most density.

| Palette          | Description                                |
| ---------------- | ------------------------------------------ |
| `@geyser`        | Green → beige → orange → red (default)     |
| `@redOrHeat`     | Yellow → orange → red → magenta            |
| `@purpYlHeat`    | Light yellow → coral → pink → purple       |
| `@lightningHeat` | Purple → teal → green → yellow             |
| `@ylGrnHeat`     | Dark teal → green → yellow                 |
| `@bluRdHeat`     | Blue → gray → red (diverging feel)         |
| `@tealRedHeat`   | Teal → green → yellow → orange → pink      |
| `@purpYlPink`    | Purple → teal → yellow → orange → red/pink |

### Raster palettes

Used by numeric, hillshade, and raster-algebra visualizations.

#### Sequential

| Palette          | Description                                                                           |
| ---------------- | ------------------------------------------------------------------------------------- |
| `@feltGrays`     | Grayscale gradient                                                                    |
| `@cbBlues`       | ColorBrewer blues                                                                     |
| `@cbPurples`     | ColorBrewer purples                                                                   |
| `@feltPinks`     | Pink gradient                                                                         |
| `@cmOceanGreens` | Ocean greens gradient                                                                 |
| `@pattFeltOcean` | Teal ocean gradient                                                                   |
| `@cmOceanDeep`   | Deep ocean gradient                                                                   |
| `@mpaInferno`    | Matplotlib inferno — note the spelling: `mpa`, not `mpl`                              |
| `@mplPlasma`     | Matplotlib plasma                                                                     |
| `@mplVirdis`     | Matplotlib viridis, perceptually uniform — note the spelling: `Virdis`, not `Viridis` |
| `@cividis`       | Cividis — colorblind-safe                                                             |
| `@feltYlRed`     | Felt yellow to red                                                                    |
| `@veg`           | Vegetation gradient                                                                   |

#### Diverging

| Palette        | Description                            |
| -------------- | -------------------------------------- |
| `@feltWeath`   | Felt weather gradient                  |
| `@feltHeat`    | Felt heat gradient                     |
| `@feltVibrant` | Felt vibrant gradient                  |
| `@nclBlOrRed`  | NCL blue-orange-red diverging          |
| `@cbRedYlGrn`  | ColorBrewer red-yellow-green diverging |
| `@cbBrBG`      | ColorBrewer brown-blue-green diverging |

#### Terrain

| Palette        | Description                |
| -------------- | -------------------------- |
| `@terrain`     | Terrain elevation gradient |
| `@rTerrain`    | R terrain gradient         |
| `@feltHypso`   | Felt hypsometric tints     |
| `@wikiTerrain` | Wikipedia terrain gradient |

#### Vegetation

| Palette     | Description                |
| ----------- | -------------------------- |
| `@nasaNDVI` | NASA NDVI vegetation index |

For raster **categorical** layers, use the vector categorical palettes above (`@catPalette1` … `@catPalette7`, `@catPalettePT1`, `@catPalettePT2`).

Raster palettes also support numbered variants to request a specific number of steps — for example `@feltGrays2`, `@feltGrays3`, … `@feltGrays9`.

## How colors map to classes

When a palette or color array drives a data-driven visualization, the number of colors should line up with the number of classes or categories:

* **Categorical:** one color per category. With `showOther: true` and an explicit `categories` array, provide **N + 1** colors — the extra one styles the "Other" bucket.
* **Classed numeric:** **N break points produce N − 1 classes**, so an explicit color array needs N − 1 entries.
* **Continuous:** provide **2 or more** colors and Felt interpolates smoothly between them in the [HCL color space](https://en.wikipedia.org/wiki/HCL_color_space).

A palette shortcut handles all of this for you — Felt expands `@galaxy` to exactly the colors it needs. Reach for explicit arrays only when you want precise control over each color.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.felt.com/felt-style-language/colors-and-palettes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
