<sk-ramp-color-map>

← prev index next →

Maps a driver value to a color by interpolating between color stops — the gradient-style color-map, and the everyday way to author a shadow-to-light color response from a few named colors.

Remarks

This is the gradient member of the ColorMap family: like every color-map it turns a driver value in [0, 1] into a color; here it does so by placing colors at positions along the ramp and interpolating between them. Driven through a sk-tonemap, 0 is full shadow and 1 is full light, so a two-stop dark-to-bright ramp reads as classic shaded lighting.

Key attributes. The colors are its sk-color-stop children, each carrying a stop-offset (its position on the ramp), a stop-color, and the interpolation mode for the segment that starts at it. Stops are shader data, so changing or animating a stop's color or offset updates the ramp without recompiling; only adding or removing stops (or attaching/detaching this map's field) is a structural change. Up to MAX_TONEMAP_STOPS stops render.

Related. Its stops are sk-color-stop elements. It is most often driven by a sk-tonemap, layered inside a sk-composite-color-map, or used as a spatial base color through a sk-color-map-source. The dither color-maps (sk-ordered-dither-color-map, sk-blue-noise-dither-color-map, sk-halftone-dither-color-map) are the two-tone siblings.

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.

Attributes

AttributeTypeDefaultDescription
remap-curveanimatable <remap-curve> Optional tone-response remap curve, mirroring the field family's
remap-phaseanimatable <number> 0 Horizontal remap phase — an animatable scalar that translates the tone
id <id> The element's unique identifier — the standard HTML global id attribute.
fieldanimatable <id-ref> Gets the optional field that modulates this color-map's weight reference by id
color-interpolation <color-interpolation> ("auto" | "srgb" | "srgb-linear" | "oklab") "auto" The color space the ramp interpolates between its stops in — the