# CanvasGradient - [addColorStop\(\)](#en-us_topic_0000001058460513_section12691015917) **CanvasGradient** provides a gradient object. ## addColorStop\(\) Adds a color stop for the** CanvasGradient** object based on the specified offset and gradient color. - Parameter

Parameter

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.

- Returned Value N/A - Example ``` const gradient = ctx.createLinearGradient(0,0,100,0); gradient.addColorStop(0,'#00ffff'); gradient.addColorStop(1,'#ffff00'); ```