# CanvasGradient > **NOTE** > > This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. **CanvasGradient** provides a gradient object. ## addColorStop addColorStop(offset: number, color: string): void Adds a color stop for the **CanvasGradient** object based on the specified offset and gradient color. **Parameters** | Name | Type | Description | | ------ | ------ | ------------------------------------------------------------ | | offset | number | Proportion of the distance between the color stop and the start point to the total length. The value ranges from 0 to 1. | | color | string | Gradient color to set. | **Example** ```html