# ColorInfo.Builder

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/ColorInfo.java+class:androidx.media3.common.ColorInfo.Builder)

*** ** * ** ***


```
public final class ColorInfo.Builder
```

<br />

*** ** * ** ***

Builds `https://developer.android.com/reference/androidx/media3/common/ColorInfo` instances.

Use `https://developer.android.com/reference/androidx/media3/common/ColorInfo#buildUpon()` to obtain a builder representing an existing `https://developer.android.com/reference/androidx/media3/common/ColorInfo`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#Builder()()` Creates a new instance with default values. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#build()()` Builds a new `https://developer.android.com/reference/androidx/media3/common/ColorInfo` instance. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setChromaBitdepth(int)(int chromaBitdepth)` Sets chroma bit depth. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setColorRange(int)(@https://developer.android.com/reference/androidx/media3/common/C.ColorRange int colorRange)` Sets the color range. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setColorSpace(int)(@https://developer.android.com/reference/androidx/media3/common/C.ColorSpace int colorSpace)` Sets the color space. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setColorTransfer(int)(@https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer int colorTransfer)` Sets the color transfer. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setHdrStaticInfo(byte[])(@https://developer.android.com/reference/androidx/annotation/Nullable byte[] hdrStaticInfo)` Sets the HdrStaticInfo as defined in CTA-861.3. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder#setLumaBitdepth(int)(int lumaBitdepth)` Sets the luma bit depth. |

## Public constructors

### Builder

```
public Builder()
```

Creates a new instance with default values.

## Public methods

### build

```
public ColorInfo build()
```

Builds a new `https://developer.android.com/reference/androidx/media3/common/ColorInfo` instance.

### setChromaBitdepth

```
@CanIgnoreReturnValue
public ColorInfo.Builder setChromaBitdepth(int chromaBitdepth)
```

Sets chroma bit depth.

| Parameters |
|---|---|
| `int chromaBitdepth` | The chromaBitdepth. The default value is `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | The builder. |

### setColorRange

```
@CanIgnoreReturnValue
public ColorInfo.Builder setColorRange(@C.ColorRange int colorRange)
```

Sets the color range.

Valid values are `https://developer.android.com/reference/androidx/media3/common/C#COLOR_RANGE_LIMITED()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_RANGE_FULL()` or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.ColorRange int colorRange` | The color range. The default value is `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. Value is one of the following: - `Format.NO_VALUE` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | This `Builder`. |

### setColorSpace

```
@CanIgnoreReturnValue
public ColorInfo.Builder setColorSpace(@C.ColorSpace int colorSpace)
```

Sets the color space.

Valid values are `https://developer.android.com/reference/androidx/media3/common/C#COLOR_SPACE_BT601()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_SPACE_BT709()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_SPACE_BT2020()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_SPACE_DISPLAY_P3()` or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.ColorSpace int colorSpace` | The color space. The default value is `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. Value is one of the following: - `Format.NO_VALUE` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | This `Builder`. |

### setColorTransfer

```
@CanIgnoreReturnValue
public ColorInfo.Builder setColorTransfer(@C.ColorTransfer int colorTransfer)
```

Sets the color transfer.

Valid values are `https://developer.android.com/reference/androidx/media3/common/C#COLOR_TRANSFER_LINEAR()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_TRANSFER_HLG()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_TRANSFER_ST2084()`, `https://developer.android.com/reference/androidx/media3/common/C#COLOR_TRANSFER_SDR()` or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer int colorTransfer` | The color transfer. The default value is `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. Value is one of the following: - `Format.NO_VALUE` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | This `Builder`. |

### setHdrStaticInfo

```
@CanIgnoreReturnValue
public ColorInfo.Builder setHdrStaticInfo(@Nullable byte[] hdrStaticInfo)
```

Sets the HdrStaticInfo as defined in CTA-861.3.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable byte[] hdrStaticInfo` | The HdrStaticInfo. The default value is `null`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | This `Builder`. |

### setLumaBitdepth

```
@CanIgnoreReturnValue
public ColorInfo.Builder setLumaBitdepth(int lumaBitdepth)
```

Sets the luma bit depth.

| Parameters |
|---|---|
| `int lumaBitdepth` | The lumaBitdepth. The default value is `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | The builder. |