Color Map
Map colours onto geometry through a gradient or ramp lookup.
What it does
Color Map runs a value through a colour Gradient. The value can be an image, a scalar field such as a Pattern, a single number, or a set of shapes. Low source values take the colour at the start of the gradient, high values the colour at the end. Phase and Period offset and repeat the gradient, so one ramp can cycle or scroll across the value range.
Behaviour follows what is plugged into Input. On an image or field, a channel is sampled per pixel (Red, Green, Blue, Alpha, Luminance, Hue, Saturation or Lightness) and either the RGB, the Alpha, or all of RGBA is repainted with the gradient result. On a set of shapes, a float attribute is read per element, position along a path, index, age, or any other numeric attribute stored earlier, and the resulting colour is written to Fill or Stroke.
When to use it
Turning a greyscale Pattern or a rendered field into a colour ramp: heat maps, gradients, false-colour looks.
Recolouring an image by hue, saturation or brightness rather than by RGB channel.
Colouring a set of shapes by position along a curve (
@u), by order (@index), or by a custom attribute such as@age.A looping or scrolling colour cycle: Period below 1, or an animated Phase.
| Parameter | Type | Default |
|---|---|---|
input | OneOf([FieldOf(Raster), FieldOf(Volume), Number, NumberArray, Collection]) | — |
gradient | Gradient | Gradient(Gradient { stops: [GradientS... |
source_attribute | String | "u" |
color_target | String | "Fill" |
source_channel | String | "Luminance" |
modify_target | String | "RGB" |
phase | Number | 0 |
period | Number | 1 |
interpolation | String | "Linear" |
strength | Number | 1 |
Gotchas
Which parameters matter depends on Input. Source Channel and Modify Target take effect on an image or field only; Source Attribute and Color Target take effect on a set of shapes only. Both groups stay visible together, so half of them can be ignored for any given input.
Period cannot reach zero. It is clamped away from zero internally so the gradient never divides by nothing, but very small values spin the gradient extremely fast. Keep Period near 1 for a single, non-repeating pass across the gradient.
Source Attribute defaults to u, normalised position along a curve or outline. It can point at any numeric attribute on the shapes, such as index or a custom one written earlier in the graph, for example age.
Worked example
Add a Color Map node and wire a Pattern, or any greyscale field or image, into Input.
Edit Gradient to build the colour ramp: a heat map, a duotone, whatever suits.
Leave Source Channel on Luminance and Modify Target on RGB to recolour the whole image from its brightness.
Lower Period below 1 to repeat the gradient several times across the value range, or animate Phase to scroll it.
See also
Stroke · Mutate · Sort · Colour fields