# ColorRamp

Artifact: [androidx.wear.watchface:watchface-complications-data](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/data/Data.kt+class:androidx.wear.watchface.complications.data.ColorRamp) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

*** ** * ** ***

<br />

```
class ColorRamp
```

<br />

*** ** * ** ***

Describes an optional color ramp for the progress bar associated with `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/RangedValueComplicationData` or `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/GoalProgressComplicationData`. This is a rendering hint that overrides the normal watch face colors when there's a particular semantic meaning. E.g. red to blue for a ranged value representing temperature.

Note this is a subset of the functionality of `https://developer.android.com/reference/android/graphics/LinearGradient.html` and the x \& y coordinates for the ramp are not known to the complication data source.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#ColorRamp(kotlin.IntArray,kotlin.Boolean)(colors: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html, interpolated: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#toString()()` |

| ### Public properties |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#colors()` The colors to render the progress bar with. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ColorRamp#interpolated()` If `true` then the colors should be smoothly interpolated when rendering the progress bar. |

## Public constructors

### ColorRamp

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
ColorRamp(colors: @ColorInt IntArray, interpolated: Boolean)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### colors

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
val colors: @ColorInt IntArray
```

The colors to render the progress bar with. For `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/RangedValueComplicationData` the first color corresponds to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/RangedValueComplicationData#min()` and the last color to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/RangedValueComplicationData#max()`. For `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/GoalProgressComplicationData` the first color corresponds to zero and the last color to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/GoalProgressComplicationData#targetValue()`. A maximum of 7 colors may be specified. When rendered the colors must be evenly spread along the progress bar. The colors must be meaningful to the user, e.g. blue = cold, red/yellow = warm.

### interpolated

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
val interpolated: Boolean
```

If `true` then the colors should be smoothly interpolated when rendering the progress bar. If `false` the colors should be rendered as equal sized regions of solid color, resulting in a noticeable step between each color.