<!--
{
  "availability" : [
    "MapKit JS: 5.45.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/LineGradient/addColorStop",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "instm/mapkit.LineGradient/addColorStop"
  },
  "title" : "addColorStop(offset, color)"
}
-->

# addColorStop(offset, color)

Adds a color transition point to the gradient.

```
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

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)