# Brush

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/Brush.kt+class:androidx.compose.ui.graphics.Brush) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  sealed class Brush
  ```
Known direct subclasses [ShaderBrush](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ShaderBrush), [SolidColor](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SolidColor)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ShaderBrush` | Brush implementation that wraps and applies a the provided shader to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` The shader can be lazily created based on a given size, or provided directly as a parameter |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SolidColor` |   |

Known indirect subclasses [LinearGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/LinearGradient), [RadialGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/RadialGradient), [SweepGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SweepGradient)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/LinearGradient` | Brush implementation used to apply a linear gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/RadialGradient` | Brush implementation used to apply a radial gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SweepGradient` | Brush implementation used to apply a sweep gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |

*** ** * ** ***

## Summary

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#composite(androidx.compose.ui.graphics.Brush,androidx.compose.ui.graphics.Brush,androidx.compose.ui.graphics.BlendMode)(dstBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush, srcBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush, blendMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/BlendMode)` Creates a composited result between 2 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` instances and the specified BlendMode. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#horizontalGradient(kotlin.Array,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.TileMode)( vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, startX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, endX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a horizontal gradient with the given colors dispersed at the provided offset defined in the colorstop pair. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#horizontalGradient(kotlin.collections.List,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.TileMode)( colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, startX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, endX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a horizontal gradient with the given colors evenly dispersed within the gradient | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#linearGradient(kotlin.Array,androidx.compose.ui.geometry.Offset,androidx.compose.ui.geometry.Offset,androidx.compose.ui.graphics.TileMode)( vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, start: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, end: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a linear gradient with the provided colors along the given start and end coordinates. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#linearGradient(kotlin.collections.List,androidx.compose.ui.geometry.Offset,androidx.compose.ui.geometry.Offset,androidx.compose.ui.graphics.TileMode)( colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, start: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, end: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a linear gradient with the provided colors along the given start and end coordinates. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#radialGradient(kotlin.Array,androidx.compose.ui.geometry.Offset,kotlin.Float,androidx.compose.ui.graphics.TileMode)( vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, radius: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a radial gradient with the given colors at the provided offset defined in the colorstop pair. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#radialGradient(kotlin.collections.List,androidx.compose.ui.geometry.Offset,kotlin.Float,androidx.compose.ui.graphics.TileMode)( colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset, radius: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a radial gradient with the given colors evenly dispersed within the gradient | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#sweepGradient(kotlin.Array,androidx.compose.ui.geometry.Offset)(vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Creates a sweep gradient with the given colors dispersed around the center with offsets defined in each colorstop pair. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#sweepGradient(kotlin.collections.List,androidx.compose.ui.geometry.Offset)(colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Creates a sweep gradient with the given colors dispersed evenly around the center. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#verticalGradient(kotlin.Array,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.TileMode)( vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, startY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, endY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a vertical gradient with the given colors at the provided offset defined in the Pair | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#verticalGradient(kotlin.collections.List,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.TileMode)( colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>, startY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, endY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode )` Creates a vertical gradient with the given colors evenly dispersed within the gradient Ex: | Cmn |

| ### Protected constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#Brush()()` | Cmn |

| ### Public functions |
|---|---|---|
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#applyTo(androidx.compose.ui.geometry.Size,androidx.compose.ui.graphics.Paint,kotlin.Float)(size: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size, p: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint, alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush#intrinsicSize()` Return the intrinsic size of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush`. | Cmn |

## Public companion functions

### composite

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun composite(dstBrush: Brush, srcBrush: Brush, blendMode: BlendMode): Brush
```

Creates a composited result between 2 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` instances and the specified BlendMode. The specified destination and source `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` inputs will be consumed as the source and destination images for the corresponding blending algorithm.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Canvas
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.ImageShader
import androidx.compose.ui.graphics.ShaderBrush
import androidx.compose.ui.graphics.drawscope.CanvasDrawScope
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.unit.dp

Box(
    modifier =
        Modifier.size(120.dp).drawWithCache {
            val bitmap = ImageBitmap(size.width.toInt(), size.height.toInt())
            CanvasDrawScope().draw(this, layoutDirection, Canvas(bitmap), size) {
                drawRect(Color.Black, style = Stroke(20.dp.toPx()))
            }
            val bitmapBrush = ShaderBrush(ImageShader(bitmap))
            val sweepBrush =
                Brush.sweepGradient(listOf(Color.Red, Color.Blue, Color.Cyan, Color.Green))
            val compositeBrush = Brush.composite(bitmapBrush, sweepBrush, BlendMode.SrcIn)
            onDrawBehind { drawRect(brush = compositeBrush) }
        }
)
```

| Parameters |
|---|---|
| `dstBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | ShaderBrush used as the destination content |
| `srcBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | ShaderBrush used as the source content |
| `blendMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/BlendMode` | BlendMode used to composite the source against the destination shader |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/BlendMode` |   |

### horizontalGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun horizontalGradient(
    vararg colorStops: Pair<Float, Color>,
    startX: Float = 0.0f,
    endX: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a horizontal gradient with the given colors dispersed at the provided offset defined in the colorstop pair.

Ex:

```kotlin
 Brush.horizontalGradient(
     0.0f to Color.Red,
     0.3f to Color.Green,
     1.0f to Color.Blue,
     startX = 0.0f,
     endX = 100.0f
)
```

```kotlin
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.horizontalGradient(
    0.0f to Color.Red,
    0.3f to Color.Green,
    1.0f to Color.Blue,
    startX = 0.0f,
    endX = 100.0f,
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors and offsets to determine how the colors are dispersed throughout the vertical gradient |
| `startX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Starting x position of the horizontal gradient. Defaults to 0 which represents the left of the drawing area |
| `endX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Ending x position of the horizontal gradient. Defaults to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` which indicates the right of the specified drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### horizontalGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun horizontalGradient(
    colors: List<Color>,
    startX: Float = 0.0f,
    endX: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a horizontal gradient with the given colors evenly dispersed within the gradient

Ex:

```kotlin
 Brush.horizontalGradient(
     listOf(Color.Red, Color.Green, Color.Blue),
     startX = 10.0f,
     endX = 20.0f
)
```

```kotlin
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.horizontalGradient(
    listOf(Color.Red, Color.Green, Color.Blue),
    startX = 10.0f,
    endX = 20.0f,
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | colors Colors to be rendered as part of the gradient |
| `startX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Starting x position of the horizontal gradient. Defaults to 0 which represents the left of the drawing area |
| `endX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Ending x position of the horizontal gradient. Defaults to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` which indicates the right of the specified drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### linearGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun linearGradient(
    vararg colorStops: Pair<Float, Color>,
    start: Offset = Offset.Zero,
    end: Offset = Offset.Infinite,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a linear gradient with the provided colors along the given start and end coordinates. The colors are dispersed at the provided offset defined in the colorstop pair.

```kotlin
 Brush.linearGradient(
     0.0f to Color.Red,
     0.3f to Color.Green,
     1.0f to Color.Blue,
     start = Offset(0.0f, 50.0f),
     end = Offset(0.0f, 100.0f)
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.linearGradient(
    0.0f to Color.Red,
    0.3f to Color.Green,
    1.0f to Color.Blue,
    start = Offset(0.0f, 50.0f),
    end = Offset(0.0f, 100.0f),
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors and their offset in the gradient area |
| `start: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Zero` | Starting position of the linear gradient. This can be set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Zero()` to position at the far left and top of the drawing area |
| `end: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Infinite` | Ending position of the linear gradient. This can be set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Infinite()` to position at the far right and bottom of the drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### linearGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun linearGradient(
    colors: List<Color>,
    start: Offset = Offset.Zero,
    end: Offset = Offset.Infinite,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a linear gradient with the provided colors along the given start and end coordinates. The colors are

```kotlin
 Brush.linearGradient(
     listOf(Color.Red, Color.Green, Color.Blue),
     start = Offset(0.0f, 50.0f),
     end = Offset(0.0f, 100.0f)
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.linearGradient(
    listOf(Color.Red, Color.Green, Color.Blue),
    start = Offset(0.0f, 50.0f),
    end = Offset(0.0f, 100.0f),
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors to be rendered as part of the gradient |
| `start: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Zero` | Starting position of the linear gradient. This can be set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Zero()` to position at the far left and top of the drawing area |
| `end: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Infinite` | Ending position of the linear gradient. This can be set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Infinite()` to position at the far right and bottom of the drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### radialGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun radialGradient(
    vararg colorStops: Pair<Float, Color>,
    center: Offset = Offset.Unspecified,
    radius: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a radial gradient with the given colors at the provided offset defined in the colorstop pair.

```kotlin
Brush.radialGradient(
     0.0f to Color.Red,
     0.3f to Color.Green,
     1.0f to Color.Blue,
     center = Offset(side1 / 2.0f, side2 / 2.0f),
     radius = side1 / 2.0f,
     tileMode = TileMode.Repeated
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.TileMode

val side1 = 100
val side2 = 200
Brush.radialGradient(
    0.0f to Color.Red,
    0.3f to Color.Green,
    1.0f to Color.Blue,
    center = Offset(side1 / 2.0f, side2 / 2.0f),
    radius = side1 / 2.0f,
    tileMode = TileMode.Repeated,
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors and offsets to determine how the colors are dispersed throughout the radial gradient |
| `center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | Center position of the radial gradient circle. If this is set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` then the center of the drawing area is used as the center for the radial gradient. `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` can be used for either `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#x()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#y()` to indicate the far right or far bottom of the drawing area respectively. |
| `radius: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Radius for the radial gradient. Defaults to positive infinity to indicate the largest radius that can fit within the bounds of the drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### radialGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun radialGradient(
    colors: List<Color>,
    center: Offset = Offset.Unspecified,
    radius: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a radial gradient with the given colors evenly dispersed within the gradient

```kotlin
Brush.radialGradient(
     listOf(Color.Red, Color.Green, Color.Blue),
     center = Offset(side1 / 2.0f, side2 / 2.0f),
     radius = side1 / 2.0f,
     tileMode = TileMode.Repeated
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.TileMode

val side1 = 100
val side2 = 200
Brush.radialGradient(
    listOf(Color.Red, Color.Green, Color.Blue),
    center = Offset(side1 / 2.0f, side2 / 2.0f),
    radius = side1 / 2.0f,
    tileMode = TileMode.Repeated,
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors to be rendered as part of the gradient |
| `center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | Center position of the radial gradient circle. If this is set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` then the center of the drawing area is used as the center for the radial gradient. `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` can be used for either `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#x()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#y()` to indicate the far right or far bottom of the drawing area respectively. |
| `radius: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Radius for the radial gradient. Defaults to positive infinity to indicate the largest radius that can fit within the bounds of the drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### sweepGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun sweepGradient(
    vararg colorStops: Pair<Float, Color>,
    center: Offset = Offset.Unspecified
): Brush
```

Creates a sweep gradient with the given colors dispersed around the center with offsets defined in each colorstop pair. The sweep begins relative to 3 o'clock and continues clockwise until it reaches the starting position again.

Ex:

```kotlin
 Brush.sweepGradient(
     0.0f to Color.Red,
     0.3f to Color.Green,
     1.0f to Color.Blue,
     center = Offset(0.0f, 100.0f)
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.sweepGradient(
    0.0f to Color.Red,
    0.3f to Color.Green,
    1.0f to Color.Blue,
    center = Offset(0.0f, 100.0f),
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors and offsets to determine how the colors are dispersed throughout the sweep gradient |
| `center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | Center position of the sweep gradient circle. If this is set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` then the center of the drawing area is used as the center for the sweep gradient |

### sweepGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun sweepGradient(colors: List<Color>, center: Offset = Offset.Unspecified): Brush
```

Creates a sweep gradient with the given colors dispersed evenly around the center. The sweep begins relative to 3 o'clock and continues clockwise until it reaches the starting position again.

Ex:

```kotlin
 Brush.sweepGradient(
     listOf(Color.Red, Color.Green, Color.Blue),
     center = Offset(10.0f, 20.0f)
)
```

```kotlin
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.sweepGradient(listOf(Color.Red, Color.Green, Color.Blue), center = Offset(10.0f, 20.0f))
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | List of colors to fill the sweep gradient |
| `center: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | Center position of the sweep gradient circle. If this is set to `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` then the center of the drawing area is used as the center for the sweep gradient |

### verticalGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun verticalGradient(
    vararg colorStops: Pair<Float, Color>,
    startY: Float = 0.0f,
    endY: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a vertical gradient with the given colors at the provided offset defined in the Pair

Ex:

```kotlin
 Brush.verticalGradient(
     0.1f to Color.Red,
     0.3f to Color.Green,
     0.5f to Color.Blue,
     startY = 0.0f,
     endY = 100.0f
)
```

```kotlin
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.verticalGradient(
    0.1f to Color.Red,
    0.3f to Color.Green,
    0.5f to Color.Blue,
    startY = 0.0f,
    endY = 100.0f,
)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `vararg colorStops: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | Colors and offsets to determine how the colors are dispersed throughout the vertical gradient |
| `startY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Starting y position of the vertical gradient. Defaults to 0 which represents the top of the drawing area |
| `endY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Ending y position of the vertical gradient. Defaults to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` which indicates the bottom of the specified drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

### verticalGradient

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun verticalGradient(
    colors: List<Color>,
    startY: Float = 0.0f,
    endY: Float = Float.POSITIVE_INFINITY,
    tileMode: TileMode = TileMode.Clamp
): Brush
```

Creates a vertical gradient with the given colors evenly dispersed within the gradient Ex:

```kotlin
 Brush.verticalGradient(
     listOf(Color.Red, Color.Green, Color.Blue),
     startY = 0.0f,
     endY = 100.0f
)
```

```kotlin
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

Brush.verticalGradient(listOf(Color.Red, Color.Green, Color.Blue), startY = 0.0f, endY = 100.0f)
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Column(modifier = Modifier.fillMaxSize().wrapContentSize()) {

    // Create a linear gradient that shows red in the top left corner
    // and blue in the bottom right corner
    val linear = Brush.linearGradient(listOf(Color.Red, Color.Blue))

    Box(modifier = Modifier.size(120.dp).background(linear))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a radial gradient centered about the drawing area that is green on
    // the outer
    // edge of the circle and magenta towards the center of the circle
    val radial = Brush.radialGradient(listOf(Color.Green, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(radial))

    Spacer(modifier = Modifier.size(20.dp))

    // Create a sweep gradient centered about the drawing area that is cyan at
    // the start angle and magenta towards the end angle.
    val sweep = Brush.sweepGradient(listOf(Color.Cyan, Color.Magenta))
    Box(modifier = Modifier.size(120.dp).background(sweep))
}
```

| Parameters |
|---|---|
| `colors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | colors Colors to be rendered as part of the gradient |
| `startY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Starting y position of the vertical gradient. Defaults to 0 which represents the top of the drawing area |
| `endY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.POSITIVE_INFINITY` | Ending y position of the vertical gradient. Defaults to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` which indicates the bottom of the specified drawing area |
| `tileMode: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode = TileMode.Clamp` | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/TileMode#Clamp()` to repeat the edge pixels |

## Protected constructors

### Brush

Cmn

```
protected Brush()
```

## Public functions

### applyTo

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
abstract fun applyTo(size: Size, p: Paint, alpha: Float): Unit
```

## Public properties

### intrinsicSize

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
open val intrinsicSize: Size
```

Return the intrinsic size of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush`. If the there is no intrinsic size (i.e. filling bounds with an arbitrary color) return `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size#Unspecified()`. If there is no intrinsic size in a single dimension, return `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` with `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-na-n.html` in the desired dimension.