---
title: "LinearGradientShader"
description: "Creates a linear gradient from `from` to `to`.

If `colorStops` is provided, each value is a number from 0.0 to 1.0 that specifies where the
color at the corresponding index in [colors] begins in the gradient. If `colorStops` is not
provided, then the colors are dispersed evenly

The behavior before [from] and after [to] is described by the `tileMode` argument. For details,
see the [TileMode] enum. If no [TileMode] is provided the default value of [TileMode.Clamp] is
used"
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun LinearGradientShader(
    from: Offset,
    to: Offset,
    colors: List<Color>,
    colorStops: List<Float>? = null,
    tileMode: TileMode = TileMode.Clamp,
): Shader
```


Creates a linear gradient from `from` to `to`.

If `colorStops` is provided, each value is a number from 0.0 to 1.0 that specifies where the
color at the corresponding index in `colors` begins in the gradient. If `colorStops` is not
provided, then the colors are dispersed evenly

The behavior before `from` and after `to` is described by the `tileMode` argument. For details,
see the `TileMode` enum. If no `TileMode` is provided the default value of `TileMode.Clamp` is
used



