public final class ColorRamp


Describes an optional color ramp for the progress bar associated with RangedValueComplicationData or 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 android.graphics.LinearGradient and the x & y coordinates for the ramp are not known to the complication data source.

Summary

Public constructors

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

Public methods

boolean
equals(Object other)
final @NonNull int[]

The colors to render the progress bar with.

int
final boolean

If true then the colors should be smoothly interpolated when rendering the progress bar.

@NonNull String

Public constructors

ColorRamp

Added in 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
public final @NonNull int[] getColors()

The colors to render the progress bar with. For RangedValueComplicationData the first color corresponds to RangedValueComplicationData.min and the last color to RangedValueComplicationData.max. For GoalProgressComplicationData the first color corresponds to zero and the last color to 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
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()