# DynamicBuilders.DynamicColor

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicBuilders.java+class:androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***

<br />

```
@RequiresSchemaVersion(major = 1, minor = 200)
public interface DynamicBuilders.DynamicColor extends DynamicBuilders.DynamicType
```

<br />

*** ** * ** ***

Interface defining a dynamic color type.

## Summary

| ### Public methods |
|---|---|
| `default @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate()()` Returns a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` and every time its value is changing, it animates from its current value to the new value. |
| `default @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate(androidx.wear.protolayout.expression.AnimationParameterBuilders.AnimationSpec)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec)` Returns a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` and every time its value is changing, it animates from its current value to the new value. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate(androidx.wear.protolayout.expression.DynamicDataKey<androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey )` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate(androidx.wear.protolayout.expression.DynamicDataKey<androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor>,androidx.wear.protolayout.expression.AnimationParameterBuilders.AnimationSpec)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec )` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate(int,int)(@https://developer.android.com/reference/androidx/annotation/ColorInt int start, @https://developer.android.com/reference/androidx/annotation/ColorInt int end)` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` which will animate over the range of colors from ` start` to `end`. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#animate(int,int,androidx.wear.protolayout.expression.AnimationParameterBuilders.AnimationSpec)( @https://developer.android.com/reference/androidx/annotation/ColorInt int start, @https://developer.android.com/reference/androidx/annotation/ColorInt int end, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec )` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` which will animate over the range of colors from ` start` to `end` with the given animation parameters. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#constant(int)(@https://developer.android.com/reference/androidx/annotation/ColorInt int constant)` Creates a constant-valued `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor`. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#from(androidx.wear.protolayout.expression.DynamicDataKey<androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey )` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#fromByteArray(byte[])(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html byte[] byteArray)` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` from a byte array generated by `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray()`. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#fromByteArray(byte[],int,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html byte[] byteArray, int offset, int length)` Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` from the provided byte array at the provided offset and length, that was generated by one of the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray()` overloads. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/ConditionScopes.ConditionScope<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor, https://developer.android.com/reference/java/lang/Integer.html>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#onCondition(androidx.wear.protolayout.expression.DynamicBuilders.DynamicBool)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicBool condition)` Bind the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` to the result of a conditional expression. |
| `default @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html byte[]` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray()()` Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into a new byte array that can later be used with `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#fromByteArray(byte[])`. |
| `default int` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray(byte[])(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html byte[] byteArray)` Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into the provided byte array, returning the amount of bytes written, that can later be used with `DynamicColor.fromByteArray(byteArray, 0, bytesWritten)`. |
| `default int` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray(byte[],int,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html byte[] byteArray, int offset, int length)` Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with `DynamicColor.fromByteArray(byteArray, offset, bytesWritten)`. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/LayoutColorUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#(androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor).asLayoutColor(kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor receiver, @https://developer.android.com/reference/androidx/annotation/ColorInt int staticArgb )` Extension for creating a `https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` from a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/LayoutColorUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#(androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor).asLayoutColor(kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor receiver, @https://developer.android.com/reference/androidx/annotation/ColorInt long staticArgb )` Extension for creating a `https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` from a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` |

## Public methods

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default @NonNull DynamicBuilders.DynamicColor animate()
```

Returns a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` and every time its value is changing, it animates from its current value to the new value.

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default @NonNull DynamicBuilders.DynamicColor animate(@NonNull AnimationParameterBuilders.AnimationSpec animationSpec)
```

Returns a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` and every time its value is changing, it animates from its current value to the new value.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec` | The animation parameters. |

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor animate(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicColor> dynamicDataKey
)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State. Every time the state value changes, this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` will animate from its current value to the new value (from the state).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey` | The source key to a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataBuilders.DynamicDataValue` with a color value. |

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor animate(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicColor> dynamicDataKey,
    @NonNull AnimationParameterBuilders.AnimationSpec animationSpec
)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State. Every time the state value changes, this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` will animate from its current value to the new value (from the state).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey` | The source key to a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataBuilders.DynamicDataValue` with a color value. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec` | The animation parameters. |

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor animate(@ColorInt int start, @ColorInt int end)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` which will animate over the range of colors from ` start` to `end`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int start` | The start value of the range. |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int end` | The end value of the range. |

### animate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor animate(
    @ColorInt int start,
    @ColorInt int end,
    @NonNull AnimationParameterBuilders.AnimationSpec animationSpec
)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` which will animate over the range of colors from ` start` to `end` with the given animation parameters.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int start` | The start value of the range. |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int end` | The end value of the range. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/AnimationParameterBuilders.AnimationSpec animationSpec` | The animation parameters. |

### constant

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor constant(@ColorInt int constant)
```

Creates a constant-valued `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor`.

### from

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicColor from(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicColor> dynamicDataKey
)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` that is bound to the value of an item of the State.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> dynamicDataKey` | The source key to a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataBuilders.DynamicDataValue` with a color value. |

### fromByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
default static @NonNull DynamicBuilders.DynamicColor fromByteArray(@NonNull byte[] byteArray)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` from a byte array generated by `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array does not contain a valid serialization |

### fromByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
default static @NonNull DynamicBuilders.DynamicColor fromByteArray(@NonNull byte[] byteArray, int offset, int length)
```

Creates a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` from the provided byte array at the provided offset and length, that was generated by one of the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#toDynamicColorByteArray()` overloads.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array does not contain a valid serialization in the provided offset and length |

### onCondition

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull ConditionScopes.ConditionScope<DynamicBuilders.DynamicColor, Integer> onCondition(@NonNull DynamicBuilders.DynamicBool condition)
```

Bind the value of this `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` to the result of a conditional expression. This will use the value given in either `https://developer.android.com/reference/androidx/wear/protolayout/expression/ConditionScopes.ConditionScope#use(T)` or `https://developer.android.com/reference/androidx/wear/protolayout/expression/ConditionScopes.IfTrueScope#elseUse(T)` depending on the value yielded from ` condition`.

### toDynamicColorByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
default @NonNull byte[] toDynamicColorByteArray()
```

Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into a new byte array that can later be used with `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor#fromByteArray(byte[])`.

### toDynamicColorByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
default int toDynamicColorByteArray(@NonNull byte[] byteArray)
```

Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into the provided byte array, returning the amount of bytes written, that can later be used with `DynamicColor.fromByteArray(byteArray, 0, bytesWritten)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array is too small |

### toDynamicColorByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
default int toDynamicColorByteArray(@NonNull byte[] byteArray, int offset, int length)
```

Serializes the `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor` into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with `DynamicColor.fromByteArray(byteArray, offset, bytesWritten)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array is too small |

## Extension functions

### LayoutColorUtil.asLayoutColor

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/types/LayoutColor.kt+function:asLayoutColor)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default final @NonNull LayoutColor LayoutColorUtil.asLayoutColor(
    @NonNull DynamicBuilders.DynamicColor receiver,
    @ColorInt int staticArgb
)
```

Extension for creating a `https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` from a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int staticArgb` | the static value that can be used when the `dynamicValue` can't be resolved. |

### LayoutColorUtil.asLayoutColor

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/types/LayoutColor.kt+function:asLayoutColor)

```
@RequiresSchemaVersion(major = 1, minor = 200)
default final @NonNull LayoutColor LayoutColorUtil.asLayoutColor(
    @NonNull DynamicBuilders.DynamicColor receiver,
    @ColorInt long staticArgb
)
```

Extension for creating a `https://developer.android.com/reference/androidx/wear/protolayout/types/LayoutColor` from a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt long staticArgb` | the static value that can be used when the `dynamicValue` can't be resolved. |