ColorBuilders.ColorProp


@RequiresSchemaVersion(major = 1, minor = 0)
class ColorBuilders.ColorProp


A property defining a color.

Summary

Nested types

Builder for ColorProp

Public functions

@ColorInt Int

Gets the static color value, in ARGB format.

DynamicBuilders.DynamicColor?

Gets the dynamic value.

String

Extension functions

ColorBuilders.ColorProp
ColorBuilders.ColorProp.withOpacity(
    ratio: @FloatRange(from = 0.0, to = 1.0) Float
)

Changes the opacity/transparency of the given color.

Public functions

getArgb

Added in 1.0.0
fun getArgb(): @ColorInt Int

Gets the static color value, in ARGB format. If a dynamic value is also set and the renderer supports dynamic values for the corresponding field, this static value will be ignored. If the static value is not specified, zero (equivalent to TRANSPARENT) will be used instead.

getDynamicValue

Added in 1.0.0
fun getDynamicValue(): DynamicBuilders.DynamicColor?

Gets the dynamic value. Note that when setting this value, the static value is still required to be set to support older renderers that only read the static value. If dynamicValue has an invalid result, the provided static value will be used instead.

toString

fun toString(): String

Extension functions

fun ColorBuilders.ColorProp.withOpacity(
    ratio: @FloatRange(from = 0.0, to = 1.0) Float
): ColorBuilders.ColorProp

Changes the opacity/transparency of the given color.

Note that this only looks at the static value of the ColorProp, any dynamic value will be ignored.