---
title: "addColorStop(offset, color)"
framework: mapkitjs
role: symbol
role_heading: Instance Method
path: mapkitjs/linegradient/addcolorstop
---

# addColorStop(offset, color)

Adds a color transition point to the gradient.

## Declaration

```data
addColorStop(offset: number, color: string): void;
```

## Parameters

- `offset`: The unit distance at which to add the color.
- `color`: The CSS color at the transition point.

## Discussion

Discussion If offset is less than 0 or greater than 1, MapKit JS logs a warning to the console, but doesn’t change the object.

## See Also

### Creating a Line Gradient

- [new LineGradient(colorStops)](mapkitjs/linegradient/linegradientconstructor.md)
- [addColorStopAtIndex(index, color)](mapkitjs/linegradient/addcolorstopatindex.md)
