---
title: "quadBlend"
description: "A four-color blend on a square: `a` to `b` across the top, `c` to `d` across the bottom, then top to bottom."
group: "paint"
groupTitle: "Painting"
categoryId: "paint"
categorySlug: "paint"
categoryTitle: "Fields, palettes & ramps"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/fields.ts#L842"
---

# quadBlend

A four-color blend on a square: `a` to `b` across the top, `c` to `d` across the bottom, then top to bottom.

```ts
quadBlend(slots: {a: PropRef; b: PropRef; c: PropRef; d: PropRef; space: PropRef}): (t1: Expr, t2: Expr, params: GpuFragmentParams) => Expr
```

Import `paint` from `shaders/std` and use `paint.quadBlend`.

Returns a function you call with two 0–1 values (across, then down) and the params. Mixes in the color space named by the `space` prop (mark it `compileTime`). For any space other than linear, declare `extraFields` named `convA`, `convB`, `convC`, `convD`, each `{schema: schema.vec3f, initial: [0, 0, 0]}`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{a: PropRef; b: PropRef; c: PropRef; d: PropRef; space: PropRef}` |  |

## Example

```ts
const base = quadBlend({a: p('colorA'), b: p('colorB'), c: p('colorC'), d: p('colorD'), space: p('colorSpace')})(t1, t2, params)
```

## See also

- [`colorLadder3`](/docs/primitives/paint/colorladder3) — A three-color blend: `a` to `b` by the first value, then on to `c` by the second.
- [`pair`](/docs/primitives/paint/pair) — A palette of two color props, mixed in the color space named by the `space` prop.

## Used by

[FlowingGradient](/docs/components/flowinggradient)