More on LinearGradient

In this lesson, we'll dive a bit deeper into `LinearGradient` in Pycairo.

Adding more steps

Sometimes, we might want a gradient that doesn’t just transition from one color to another. We might want the gradient to move through multiple colors. This can be done using extra stops.

For one stop, we will use the following function once:

pattern.add_color_stop_rgb(position, r, g, b)

Now, we will run this function as many times as we want to add stops.

Here is an example of this:

Get hands-on with 1200+ tech skills courses.