🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

RemoteColor

Represents a color that can be used with canvas APIs.

Source set: Android
public open class RemoteColor internal constructor(
    @get:Suppress("AutoBoxing") public override val constantValueOrNull: Color?,
    internal override val cacheKey: RemoteStateCacheKey,
    alpha: RemoteFloat?,
    red: RemoteFloat?,
    green: RemoteFloat?,
    blue: RemoteFloat?,
    internal val idProvider: (creationState: RemoteComposeCreationState) -> Int,
) : BaseRemoteState<Color>(cacheKey)

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

Properties

alpha

Source set: Android
public val alpha: RemoteFloat

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

red

Source set: Android
public val red: RemoteFloat

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

green

Source set: Android
public val green: RemoteFloat

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

blue

Source set: Android
public val blue: RemoteFloat

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

hue

Source set: Android
public val hue: RemoteFloat

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

saturation

Source set: Android
public val saturation: RemoteFloat

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

brightness

Source set: Android
public val brightness: RemoteFloat

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

Functions

copy

Source set: Android
public 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 Optional RemoteFloat to override the alpha component.
red Optional RemoteFloat to override the red component.
green Optional RemoteFloat to override the green component.
blue Optional RemoteFloat to override the blue component.

Return

A new RemoteColor with the specified components overridden.

Members

Companion

Source set: Android
public companion object

Functions

invoke

Source set: Android
public operator fun invoke(value: Color): RemoteColor

Creates a RemoteColor from a literal Color value.

Parameters

value The Color value.

Return

A RemoteColor representing the constant color.

createNamedRemoteColor

Source set: Android
public 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 A unique name to identify this state within its domain.
defaultValue The initial Color value for the named remote color.
domain The domain for the named state. Defaults to RemoteState.Domain.User.

Return

A RemoteColor representing the named color.

hsv

Source set: Android
public 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 A RemoteFloat representing the hue in the range [0..1].
saturation A RemoteFloat representing the saturation in the range [0..1].
value A RemoteFloat representing the brightness in the range [0..1].
alpha The fixed alpha value the range [0..1].

Return

A new RemoteColor derived from the provided HSV components.

rgb

Source set: Android
public 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

alpha RemoteFloat representing the alpha in the range [0..1].
red A RemoteFloat representing red in the range [0..1].
green A RemoteFloat representing green in the range [0..1].
blue A RemoteFloat representing blue in the range [0..1].

Return

A new RemoteColor derived from the provided ARGB components.

Content updated: