---
title: "layers"
description: "Stacks colors into one, first entry at the back."
group: "paint"
groupTitle: "Painting"
categoryId: "compose"
categorySlug: "compose"
categoryTitle: "Layering & output"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/compose.ts#L88"
---

# layers

Stacks colors into one, first entry at the back.

```ts
layers(entries: Layer[]): Expr
```

Import `compose` from `shaders/std` and use `compose.layers`.

Each entry is a color, or `{paint, blend, opacity, behind}` (see `Layer`). Entries add together unless one asks for `'screen'`. Needs at least one entry.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `entries` | `Layer[]` |  |

## Example

```ts
const rgb = layers([
  {paint: sky, opacity: 0.6},
  {paint: stars, behind: fog.transmittance},
  {paint: glow, blend: 'screen'},
])
```

## See also

- [`layered`](/docs/primitives/compose/layered) — Builds N variations of one thing from a data list and sums them with weights.
- [`emissiveAlpha`](/docs/primitives/compose/emissivealpha) — Turns an rgb light value into a color with alpha, so glows composite over transparency.

## Used by

[Nebula](/docs/components/nebula)