---
title: "gradientMap"
description: "Recolor the child by its brightness through a gradient, the Photoshop gradient map."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.color"
categorySlug: "effects-color"
categoryTitle: "Color effects"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/color.ts#L400"
---

# gradientMap

Recolor the child by its brightness through a gradient, the Photoshop gradient map.

```ts
gradientMap(slots: {
    palette: PropRef
    colorLow: PropRef
    colorMid: PropRef
    colorHigh: PropRef
    speed: PropRef
    contrast: ArgSpec
    blackPoint: ArgSpec
    whitePoint: ArgSpec
    strength: PropRef
    colorSpace: PropRef
}): PointwiseEffect
```

Import `effects` from `shaders/std` and use `effects.color.gradientMap`.

`palette` is a select prop declared `compileTime: true`: one of the built-in gradients `'rainbow' | 'sunset' | 'ocean' | 'fire' | 'pastel' | 'neon'`, or `'custom'` to use `colorLow`, `colorMid` and `colorHigh` (shadows, midtones, highlights) mixed in `colorSpace`. `blackPoint` and `whitePoint` (0–1) clip the input brightness. `contrast` (0–3) steepens the mapping. `speed` scrolls the gradient over time; 0 holds it still. `strength` (0–1) fades the result over the original. Alpha kept.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{
    palette: PropRef
    colorLow: PropRef
    colorMid: PropRef
    colorHigh: PropRef
    speed: PropRef
    contrast: ArgSpec
    blackPoint: ArgSpec
    whitePoint: ArgSpec
    strength: PropRef
    colorSpace: PropRef
}` |  |

## Example

```ts
effect: gradientMap({palette: p('palette'), colorLow: p('colorLow'), colorMid: p('colorMid'), colorHigh: p('colorHigh'), speed: p('speed'), contrast: p('contrast'), blackPoint: p('blackPoint'), whitePoint: p('whitePoint'), strength: p('strength'), colorSpace: p('colorSpace')})
```

> **Tip.** Declare `identityWhen: isZero('strength')`.

## See also

- [`duotone`](/docs/primitives/effects-color/duotone) — Repaint the child in two colors: `colorA` for the shadows, `colorB` for the highlights.
- [`tritone`](/docs/primitives/effects-color/tritone) — Repaint the child in three colors: `colorA` for the shadows, `colorB` for the midtones, `colorC` for the highlights.

## Used by

[GradientMap](/docs/components/gradientmap)