---
title: "Colors"
description: "Set the dot color, run a pattern through a palette of up to 8 colors, and tune the glow and the dark dots under the lit ones."
url: "https://dotsengine.dev/docs/colors"
markdown: "https://dotsengine.dev/docs/colors.md"
updated: 2026-12-01
---

# Colors

Set the dot color, run a pattern through a palette of up to 8 colors, and tune the glow and the dark dots under the lit ones.

> The other pages of this site, each with its Markdown copy, are listed in [llms.txt](https://dotsengine.dev/llms.txt).

By default the dots take the text color of their parent, like an icon. So a loader fits light and dark pages with no work.

## One color

`color` takes any CSS color. A theme token keeps the loader in step with your theme.

```tsx
<DotMatrix pattern="pulse" color="var(--color-info)" />
<DotMatrix pattern="pulse" className="text-amber-500" />
```

```dot-matrix
[
  { "name": "foreground", "pattern": "pulse", "lattice": "circle" },
  { "name": "chart-2", "pattern": "pulse", "lattice": "circle", "color": "chart-2" },
  { "name": "warning", "pattern": "pulse", "lattice": "circle", "color": "warning" },
  { "name": "destructive", "pattern": "pulse", "lattice": "circle", "color": "destructive" }
]
```

## A palette

`look.colors` takes 2 to 8 colors. The first one is the dot color, unless you pass `color`. A pattern with a `tint` channel picks a color for each dot from the list: 0 is the first color, 1 the last. A dot between two places blends the two neighbor colors.

Of the built-in patterns, only `spectrum` has a `tint` channel. On other patterns the palette shows only its first color.

```tsx
<DotMatrix pattern="spectrum" look={{ colors: ["#2BD4E0", "#9D7BFF", "#FF5C7A"] }} />
```

```dot-matrix
{
  "name": "spectrum",
  "pattern": "spectrum",
  "lattice": "capsule",
  "size": 48,
  "colors": ["chart-2", "chart-5", "chart-6", "chart-4"]
}
```

Your own scene can tint too. This one sweeps the palette from left to right:

```dot-matrix
{
  "pattern": {
    "duration": 2400,
    "light": { "op": "paint", "form": { "form": "circle", "radius": { "fn": "pulse", "low": 0.3, "high": 0.8 } } },
    "tint": {
      "op": "light",
      "value": { "fn": "clamp", "of": { "fn": "add", "of": [0.5, { "fn": "mul", "of": [0.5, { "fn": "ref", "name": "u" }] }] } }
    }
  },
  "lattice": "circle",
  "colors": ["chart-1", "chart-4", "chart-2"]
}
```

## Glow and the dark dots

A lit dot has a bright core and a soft halo. Under the pattern, the dots that are off still show, dim, like a real LED panel.

| Look key | Default | What it does |
| --- | --- | --- |
| `glow` | 1 | The halo, from 0 to 1. Light pages show a third of it. |
| `floor` | 1 | The dots that are off, from 0 (hidden) to 1. Use 0 for an effect over content. |

```dot-matrix
[
  { "name": "glow 0", "pattern": "breathe", "lattice": "circle", "glow": 0, "color": "chart-2" },
  { "name": "glow 1", "pattern": "breathe", "lattice": "circle", "glow": 1, "color": "chart-2" },
  { "name": "floor 0", "pattern": "breathe", "lattice": "circle", "floor": 0, "color": "chart-2" }
]
```

The core of a lit dot leans toward black on light pages and toward white on dark pages. So a dot reads as lit in both themes, with no color of its own for each.

## Theme tokens

Every color you pass in code can be a CSS variable. So a loader follows your theme in light and dark mode.

```tsx
<DotMatrix pattern="radar" color="var(--chart-2)" />
<DotMatrix pattern="spectrum" look={{ colors: ["var(--chart-1)", "var(--chart-3)", "var(--chart-5)"] }} />
```

- Every shadcn theme defines `--chart-1` to `--chart-5`. The [example items](https://dotsengine.dev/docs/examples.md) use them.
- A Tailwind v4 theme also has `--color-*` names, such as `var(--color-primary)`.
- The variable must be set on the loader or a parent of it.
- A `var()` inside another color function, such as `color-mix()`, works too, but it is slower to read.

## Theme switches

The DOM and SVG renderers draw with CSS, so they follow a theme switch at once. The canvas and WebGL renderers read the colors again when one of these changes:

- the `class`, `style`, `data-theme` or `data-color-scheme` attribute of `<html>`
- the system color scheme (`prefers-color-scheme`)

If your theme switch changes something else, give the loader a new `key` after the switch.

## Colors in a preset

A [preset](https://dotsengine.dev/docs/presets.md) is a file that other people can share. So its `colors` take only plain colors: hex, a color name, or `rgb()`, `hsl()`, `oklch()`, `oklab()`, `lab()`, `lch()` or `hwb()` with numbers. A `var()` fails the check. Pass theme tokens in code, with the `color` prop.
