# 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)

*** ** * ** ***


```
public final class ColorRamp
```

<br />

*** ** * ** ***

Describes an optional color ramp for the progress bar associated with `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData` or `https://developer.android.com/reference/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/androidx/wear/watchface/complications/data/ColorRamp#ColorRamp(kotlin.IntArray,kotlin.Boolean)(@https://developer.android.com/reference/androidx/annotation/ColorInt @https://developer.android.com/reference/androidx/annotation/NonNull int[] colors, boolean interpolated)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull int[]` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp#getColors()()` The colors to render the progress bar with. |
| `int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp#isInterpolated()()` If `true` then the colors should be smoothly interpolated when rendering the progress bar. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp#toString()()` |

## Public constructors

### ColorRamp

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

```
public ColorRamp(@ColorInt @NonNull int[] colors, boolean interpolated)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getColors

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

```
public final @NonNull int[] getColors()
```

The colors to render the progress bar with. For `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData` the first color corresponds to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#min()` and the last color to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#max()`. For `https://developer.android.com/reference/androidx/wear/watchface/complications/data/GoalProgressComplicationData` the first color corresponds to zero and the last color to `https://developer.android.com/reference/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.

### hashCode

```
public int hashCode()
```

### isInterpolated

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

```
public final boolean isInterpolated()
```

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.

### toString

```
public @NonNull String toString()
```