open class RemoteColor : BaseRemoteState


Represents a color that can be used with canvas APIs.

RemoteColor represents a color value that can be a constant, a named variable, or a dynamic expression (e.g., a color interpolation).

Summary

Public companion functions

RemoteColor
createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain
)

Creates a named RemoteColor with an initial value.

RemoteColor
hsv(
    hue: RemoteFloat,
    saturation: RemoteFloat,
    value: RemoteFloat,
    alpha: RemoteFloat
)

Creates a RemoteColor from remote hue, saturation, and value (brightness) components.

operator RemoteColor
invoke(value: Color)

Creates a RemoteColor from a literal Color value.

RemoteColor
rgb(
    red: RemoteFloat,
    green: RemoteFloat,
    blue: RemoteFloat,
    alpha: RemoteFloat
)

Creates a RemoteColor from remote alpha, red, green, and blue components.

Public functions

RemoteColor
copy(
    alpha: RemoteFloat?,
    red: RemoteFloat?,
    green: RemoteFloat?,
    blue: RemoteFloat?
)

Creates a copy of this RemoteColor with the ability to override individual ARGB components.

Public properties

RemoteFloat

Returns a RemoteFloat that evaluates to the alpha of this RemoteColor in the range 0..1.

RemoteFloat

Returns a RemoteFloat that evaluates to the blue of this RemoteColor in the range 0..1.

RemoteFloat

Returns a RemoteFloat that evaluates to the brightness of this RemoteColor in the range 0..1.

open Color?

The constant value or null if there isn't one.

RemoteFloat

Returns a RemoteFloat that evaluates to the green of this RemoteColor in the range 0..1.

RemoteFloat

Returns a RemoteFloat that evaluates to the hue of this RemoteColor in the range 0..1.

RemoteFloat

Returns a RemoteFloat that evaluates to the red of this RemoteColor in the range 0..1.

RemoteFloat

Returns a RemoteFloat that evaluates to the saturation of this RemoteColor in the range 0..1.

Inherited properties

From androidx.compose.remote.creation.compose.state.RemoteState
open Color

The constant value held by this state.

open Boolean

Whether or not this remote state evaluates to a constant value.

Public companion functions

createNamedRemoteColor

Added in 1.0.0-alpha07
fun createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteColor

Creates a named RemoteColor with an initial value.

Named remote colors can be set via AndroidRemoteContext.setNamedColor.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Color

The initial Color value for the named remote color.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteColor

A RemoteColor representing the named color.

hsv

Added in 1.0.0-alpha07
fun hsv(
    hue: RemoteFloat,
    saturation: RemoteFloat,
    value: RemoteFloat,
    alpha: RemoteFloat = 1.rf
): RemoteColor

Creates a RemoteColor from remote hue, saturation, and value (brightness) components. The resulting color is expressed as a RemoteColor expression that combines these inputs.

Parameters
hue: RemoteFloat

A RemoteFloat representing the hue in the range 0..1.

saturation: RemoteFloat

A RemoteFloat representing the saturation in the range 0..1.

value: RemoteFloat

A RemoteFloat representing the brightness in the range 0..1.

alpha: RemoteFloat = 1.rf

The fixed alpha value the range 0..1.

Returns
RemoteColor

A new RemoteColor derived from the provided HSV components.

invoke

Added in 1.0.0-alpha07
operator fun invoke(value: Color): RemoteColor

Creates a RemoteColor from a literal Color value.

Parameters
value: Color

The Color value.

Returns
RemoteColor

A RemoteColor representing the constant color.

rgb

Added in 1.0.0-alpha07
fun rgb(
    red: RemoteFloat,
    green: RemoteFloat,
    blue: RemoteFloat,
    alpha: RemoteFloat = 1.rf
): RemoteColor

Creates a RemoteColor from remote alpha, red, green, and blue components.

Parameters
red: RemoteFloat

A RemoteFloat representing red in the range 0..1.

green: RemoteFloat

A RemoteFloat representing green in the range 0..1.

blue: RemoteFloat

A RemoteFloat representing blue in the range 0..1.

alpha: RemoteFloat = 1.rf

RemoteFloat representing the alpha in the range 0..1.

Returns
RemoteColor

A new RemoteColor derived from the provided ARGB components.

Public functions

copy

Added in 1.0.0-alpha07
fun copy(
    alpha: RemoteFloat? = null,
    red: RemoteFloat? = null,
    green: RemoteFloat? = null,
    blue: RemoteFloat? = null
): RemoteColor

Creates a copy of this RemoteColor with the ability to override individual ARGB components. If a component is not specified, it defaults to the corresponding component of the original RemoteColor.

Parameters
alpha: RemoteFloat? = null

Optional RemoteFloat to override the alpha component.

red: RemoteFloat? = null

Optional RemoteFloat to override the red component.

green: RemoteFloat? = null

Optional RemoteFloat to override the green component.

blue: RemoteFloat? = null

Optional RemoteFloat to override the blue component.

Returns
RemoteColor

A new RemoteColor with the specified components overridden.

Public properties

alpha

Added in 1.0.0-alpha07
val alphaRemoteFloat

Returns a RemoteFloat that evaluates to the alpha of this RemoteColor in the range 0..1.

blue

Added in 1.0.0-alpha07
val blueRemoteFloat

Returns a RemoteFloat that evaluates to the blue of this RemoteColor in the range 0..1.

brightness

Added in 1.0.0-alpha07
val brightnessRemoteFloat

Returns a RemoteFloat that evaluates to the brightness of this RemoteColor in the range 0..1.

constantValueOrNull

open val constantValueOrNullColor?

The constant value or null if there isn't one.

green

Added in 1.0.0-alpha07
val greenRemoteFloat

Returns a RemoteFloat that evaluates to the green of this RemoteColor in the range 0..1.

hue

Added in 1.0.0-alpha07
val hueRemoteFloat

Returns a RemoteFloat that evaluates to the hue of this RemoteColor in the range 0..1.

red

Added in 1.0.0-alpha07
val redRemoteFloat

Returns a RemoteFloat that evaluates to the red of this RemoteColor in the range 0..1.

saturation

Added in 1.0.0-alpha07
val saturationRemoteFloat

Returns a RemoteFloat that evaluates to the saturation of this RemoteColor in the range 0..1.