object RemoteColor.Companion


Summary

Public functions

RemoteColor
createNamedRemoteColor(
    name: String,
    defaultValue: @ColorInt Int,
    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(color: @ColorInt Int)

Creates a RemoteColor from a literal ARGB integer value.

operator RemoteColor
invoke(
    red: @FloatRange(from = 0.0, to = 1.0) Float,
    green: @FloatRange(from = 0.0, to = 1.0) Float,
    blue: @FloatRange(from = 0.0, to = 1.0) Float,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float
)

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

operator RemoteColor
invoke(
    red: RemoteFloat,
    green: RemoteFloat,
    blue: RemoteFloat,
    alpha: RemoteFloat
)

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

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

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

Extension functions

RemoteColor
RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: @ColorInt Int,
    darkFallback: @ColorInt Int
)

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

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

Creates a named RemoteColor with an initial value.

RemoteColor
RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: Color,
    darkFallback: Color
)

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

Public functions

createNamedRemoteColor

Added in 1.0.0-alpha23
fun createNamedRemoteColor(
    name: String,
    defaultValue: @ColorInt Int,
    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: @ColorInt Int

The initial ARGB integer 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-alpha23
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

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

Returns
RemoteColor

A new RemoteColor derived from the provided HSV components.

invoke

Added in 1.0.0-alpha23
operator fun invoke(color: @ColorInt Int): RemoteColor

Creates a RemoteColor from a literal ARGB integer value.

Parameters
color: @ColorInt Int

The ARGB integer color value.

Returns
RemoteColor

A RemoteColor representing the constant color.

invoke

Added in 1.0.0-alpha23
operator fun invoke(
    red: @FloatRange(from = 0.0, to = 1.0) Float,
    green: @FloatRange(from = 0.0, to = 1.0) Float,
    blue: @FloatRange(from = 0.0, to = 1.0) Float,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
): RemoteColor

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

Parameters
red: @FloatRange(from = 0.0, to = 1.0) Float

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

green: @FloatRange(from = 0.0, to = 1.0) Float

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

blue: @FloatRange(from = 0.0, to = 1.0) Float

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

alpha: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f

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

Returns
RemoteColor

A RemoteColor representing the constant color.

invoke

Added in 1.0.0-alpha23
operator fun invoke(
    red: RemoteFloat,
    green: RemoteFloat,
    blue: RemoteFloat,
    alpha: RemoteFloat = 1.rf
): RemoteColor

Creates a RemoteColor from remote red, green, blue, and alpha 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 RemoteColor representing the color expression.

rgb

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

Creates a RemoteColor from remote red, green, blue, and alpha 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 RGBA components.

Extension functions

RemoteColor.Companion.createThemedRemoteColor

fun RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: @ColorInt Int,
    darkFallback: @ColorInt Int
): RemoteColor

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

Parameters
lightColorRes: @ColorRes Int

The android.R.color resource ID for light mode.

darkColorRes: @ColorRes Int

The android.R.color resource ID for dark mode.

lightFallback: @ColorInt Int

The fallback ARGB color integer to use in light mode if the theme color cannot be resolved.

darkFallback: @ColorInt Int

The fallback ARGB color integer to use in dark mode if the theme color cannot be resolved.

Returns
RemoteColor

A RemoteColor representing the themed color.

RemoteColor.Companion.createNamedRemoteColor

fun RemoteColor.Companion.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.

RemoteColor.Companion.createThemedRemoteColor

fun RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: Color,
    darkFallback: Color
): RemoteColor

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

Parameters
lightColorRes: @ColorRes Int

The android.R.color resource ID for light mode.

darkColorRes: @ColorRes Int

The android.R.color resource ID for dark mode.

lightFallback: Color

The fallback Color value to use in light mode if the theme color cannot be resolved.

darkFallback: Color

The fallback Color value to use in dark mode if the theme color cannot be resolved.

Returns
RemoteColor

A RemoteColor representing the themed color.